brew-tui 0.6.2 → 0.8.0
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/build/{brewbar-installer-WJZKSELD.js → brewbar-installer-DCF37YM3.js} +2 -2
- package/build/{brewfile-manager-OITSKEHY.js → brewfile-manager-6LXONGSA.js} +4 -4
- package/build/{chunk-QPXROTAP.js → chunk-3OIVIQWW.js} +59 -17
- package/build/chunk-3OIVIQWW.js.map +1 -0
- package/build/{chunk-KSIAKLE2.js → chunk-3VDIKVS3.js} +3 -3
- package/build/{chunk-5MYWF5D7.js → chunk-FIPCCYL6.js} +2 -2
- package/build/{chunk-Z2VN4VYQ.js → chunk-JYHINZVV.js} +19 -4
- package/build/chunk-JYHINZVV.js.map +1 -0
- package/build/{chunk-6NA4INJS.js → chunk-OHMNJ3EA.js} +39 -3
- package/build/chunk-OHMNJ3EA.js.map +1 -0
- package/build/{chunk-EHIBIFCB.js → chunk-QZZZAAWG.js} +4 -2
- package/build/chunk-QZZZAAWG.js.map +1 -0
- package/build/{chunk-PVSE6XO7.js → chunk-VLREAA5F.js} +19 -3
- package/build/{chunk-PVSE6XO7.js.map → chunk-VLREAA5F.js.map} +1 -1
- package/build/compliance-checker-MAREAFDH.js +12 -0
- package/build/{history-logger-ZGYRAFON.js → history-logger-FJ3HZSFU.js} +3 -3
- package/build/index.js +1061 -850
- package/build/index.js.map +1 -1
- package/build/{snapshot-YWIOFQ5H.js → snapshot-JDRSBMG6.js} +3 -3
- package/build/{sync-engine-DIYXV66P.js → sync-engine-CIL6C44Z.js} +5 -5
- package/build/version-check-RA6SHCXI.js +64 -0
- package/build/version-check-RA6SHCXI.js.map +1 -0
- package/package.json +1 -1
- package/build/chunk-6NA4INJS.js.map +0 -1
- package/build/chunk-EHIBIFCB.js.map +0 -1
- package/build/chunk-QPXROTAP.js.map +0 -1
- package/build/chunk-Z2VN4VYQ.js.map +0 -1
- package/build/compliance-checker-7NMFKWTI.js +0 -12
- /package/build/{brewbar-installer-WJZKSELD.js.map → brewbar-installer-DCF37YM3.js.map} +0 -0
- /package/build/{brewfile-manager-OITSKEHY.js.map → brewfile-manager-6LXONGSA.js.map} +0 -0
- /package/build/{chunk-KSIAKLE2.js.map → chunk-3VDIKVS3.js.map} +0 -0
- /package/build/{chunk-5MYWF5D7.js.map → chunk-FIPCCYL6.js.map} +0 -0
- /package/build/{compliance-checker-7NMFKWTI.js.map → compliance-checker-MAREAFDH.js.map} +0 -0
- /package/build/{history-logger-ZGYRAFON.js.map → history-logger-FJ3HZSFU.js.map} +0 -0
- /package/build/{snapshot-YWIOFQ5H.js.map → snapshot-JDRSBMG6.js.map} +0 -0
- /package/build/{sync-engine-DIYXV66P.js.map → sync-engine-CIL6C44Z.js.map} +0 -0
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
loadSnapshots,
|
|
7
7
|
pruneSnapshots,
|
|
8
8
|
saveSnapshot
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-VLREAA5F.js";
|
|
10
|
+
import "./chunk-QZZZAAWG.js";
|
|
11
11
|
import "./chunk-KDHEUNRI.js";
|
|
12
12
|
export {
|
|
13
13
|
SNAPSHOT_RETENTION_LIMIT,
|
|
@@ -18,4 +18,4 @@ export {
|
|
|
18
18
|
pruneSnapshots,
|
|
19
19
|
saveSnapshot
|
|
20
20
|
};
|
|
21
|
-
//# sourceMappingURL=snapshot-
|
|
21
|
+
//# sourceMappingURL=snapshot-JDRSBMG6.js.map
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
loadSyncConfig,
|
|
4
4
|
saveSyncConfig,
|
|
5
5
|
sync
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-3OIVIQWW.js";
|
|
7
|
+
import "./chunk-VLREAA5F.js";
|
|
8
8
|
import {
|
|
9
9
|
getMachineId
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-QZZZAAWG.js";
|
|
11
|
+
import "./chunk-OHMNJ3EA.js";
|
|
12
12
|
import "./chunk-KDHEUNRI.js";
|
|
13
13
|
export {
|
|
14
14
|
applyConflictResolutions,
|
|
@@ -17,4 +17,4 @@ export {
|
|
|
17
17
|
saveSyncConfig,
|
|
18
18
|
sync
|
|
19
19
|
};
|
|
20
|
-
//# sourceMappingURL=sync-engine-
|
|
20
|
+
//# sourceMappingURL=sync-engine-CIL6C44Z.js.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// src/lib/version-check.ts
|
|
2
|
+
import { execFile } from "child_process";
|
|
3
|
+
import { promisify } from "util";
|
|
4
|
+
import { access } from "fs/promises";
|
|
5
|
+
var execFileAsync = promisify(execFile);
|
|
6
|
+
var BREWBAR_INFO_PLIST = "/Applications/BrewBar.app/Contents/Info.plist";
|
|
7
|
+
var CONTRACT_VERSION = 1;
|
|
8
|
+
function expectedVersion() {
|
|
9
|
+
return "0.8.0";
|
|
10
|
+
}
|
|
11
|
+
async function readBrewBarVersion() {
|
|
12
|
+
try {
|
|
13
|
+
await access(BREWBAR_INFO_PLIST);
|
|
14
|
+
} catch {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
const { stdout } = await execFileAsync(
|
|
19
|
+
"/usr/bin/defaults",
|
|
20
|
+
["read", BREWBAR_INFO_PLIST.replace(/\.plist$/, ""), "CFBundleShortVersionString"],
|
|
21
|
+
{ timeout: 5e3 }
|
|
22
|
+
);
|
|
23
|
+
return stdout.trim() || null;
|
|
24
|
+
} catch {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function compareSemver(a, b) {
|
|
29
|
+
const pa = a.split(".").map((p) => parseInt(p, 10) || 0);
|
|
30
|
+
const pb = b.split(".").map((p) => parseInt(p, 10) || 0);
|
|
31
|
+
const len = Math.max(pa.length, pb.length);
|
|
32
|
+
for (let i = 0; i < len; i++) {
|
|
33
|
+
const diff = (pa[i] ?? 0) - (pb[i] ?? 0);
|
|
34
|
+
if (diff !== 0) return diff;
|
|
35
|
+
}
|
|
36
|
+
return 0;
|
|
37
|
+
}
|
|
38
|
+
async function checkBrewBarVersion() {
|
|
39
|
+
if (process.platform !== "darwin") {
|
|
40
|
+
return { kind: "unknown", reason: "not-macos" };
|
|
41
|
+
}
|
|
42
|
+
const installed = await readBrewBarVersion();
|
|
43
|
+
if (installed === null) {
|
|
44
|
+
try {
|
|
45
|
+
await access(BREWBAR_INFO_PLIST);
|
|
46
|
+
return { kind: "unknown", reason: "plist-unreadable" };
|
|
47
|
+
} catch {
|
|
48
|
+
return { kind: "not-installed" };
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const expected = expectedVersion();
|
|
52
|
+
const cmp = compareSemver(installed, expected);
|
|
53
|
+
if (cmp === 0) return { kind: "ok", installed, expected };
|
|
54
|
+
if (cmp < 0) return { kind: "outdated", installed, expected };
|
|
55
|
+
return { kind: "newer", installed, expected };
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
CONTRACT_VERSION,
|
|
59
|
+
checkBrewBarVersion,
|
|
60
|
+
compareSemver,
|
|
61
|
+
expectedVersion,
|
|
62
|
+
readBrewBarVersion
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=version-check-RA6SHCXI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/version-check.ts"],"sourcesContent":["import { execFile } from 'node:child_process';\nimport { promisify } from 'node:util';\nimport { access } from 'node:fs/promises';\n\nconst execFileAsync = promisify(execFile);\nconst BREWBAR_INFO_PLIST = '/Applications/BrewBar.app/Contents/Info.plist';\n\n// CONTRACT_VERSION is bumped only when the cross-platform contract changes\n// (license schema, encryption scheme, IPC). Marketing version drifts often;\n// contract version drifts rarely. BrewBar must embed the same number.\n// TODO: surface this number from a shared file once the next contract bump lands.\nexport const CONTRACT_VERSION = 1;\n\nexport type BrewBarVersionStatus =\n | { kind: 'ok'; installed: string; expected: string }\n | { kind: 'outdated'; installed: string; expected: string }\n | { kind: 'newer'; installed: string; expected: string }\n | { kind: 'not-installed' }\n | { kind: 'unknown'; reason: string };\n\nexport function expectedVersion(): string {\n return process.env.APP_VERSION ?? '0.0.0';\n}\n\nexport async function readBrewBarVersion(): Promise<string | null> {\n try {\n await access(BREWBAR_INFO_PLIST);\n } catch {\n return null;\n }\n try {\n const { stdout } = await execFileAsync(\n '/usr/bin/defaults',\n ['read', BREWBAR_INFO_PLIST.replace(/\\.plist$/, ''), 'CFBundleShortVersionString'],\n { timeout: 5000 },\n );\n return stdout.trim() || null;\n } catch {\n return null;\n }\n}\n\n/**\n * Lexicographic semver compare, no pre-release support. Returns:\n * < 0 if a < b, 0 if equal, > 0 if a > b.\n */\nexport function compareSemver(a: string, b: string): number {\n const pa = a.split('.').map((p) => parseInt(p, 10) || 0);\n const pb = b.split('.').map((p) => parseInt(p, 10) || 0);\n const len = Math.max(pa.length, pb.length);\n for (let i = 0; i < len; i++) {\n const diff = (pa[i] ?? 0) - (pb[i] ?? 0);\n if (diff !== 0) return diff;\n }\n return 0;\n}\n\nexport async function checkBrewBarVersion(): Promise<BrewBarVersionStatus> {\n if (process.platform !== 'darwin') {\n return { kind: 'unknown', reason: 'not-macos' };\n }\n const installed = await readBrewBarVersion();\n if (installed === null) {\n // Distinguish \"not present\" from \"present but unreadable\"\n try {\n await access(BREWBAR_INFO_PLIST);\n return { kind: 'unknown', reason: 'plist-unreadable' };\n } catch {\n return { kind: 'not-installed' };\n }\n }\n const expected = expectedVersion();\n const cmp = compareSemver(installed, expected);\n if (cmp === 0) return { kind: 'ok', installed, expected };\n if (cmp < 0) return { kind: 'outdated', installed, expected };\n return { kind: 'newer', installed, expected };\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS,cAAc;AAEvB,IAAM,gBAAgB,UAAU,QAAQ;AACxC,IAAM,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,MAAI,QAAQ,EAAG,QAAO,EAAE,MAAM,MAAM,WAAW,SAAS;AACxD,MAAI,MAAM,EAAG,QAAO,EAAE,MAAM,YAAY,WAAW,SAAS;AAC5D,SAAO,EAAE,MAAM,SAAS,WAAW,SAAS;AAC9C;","names":[]}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/i18n/index.ts","../src/i18n/en.ts","../src/i18n/es.ts","../src/lib/fetch-timeout.ts"],"sourcesContent":["import { create } from 'zustand';\nimport en from './en.js';\nimport es from './es.js';\nimport type { Translations, TranslationKey } from './en.js';\n\nexport type Locale = 'en' | 'es';\n\nconst locales: Record<Locale, Translations> = { en, es };\n\nfunction isLocale(s: string): s is Locale {\n return s === 'en' || s === 'es';\n}\n\nfunction detectLocale(): Locale {\n const flag = process.argv.find((a) => a.startsWith('--lang='));\n if (flag) {\n const code = flag.split('=')[1];\n if (code && isLocale(code)) return code;\n }\n const env = process.env.LANG ?? process.env.LC_ALL ?? process.env.LC_MESSAGES ?? '';\n const prefix = env.split(/[_.]/)[0] ?? '';\n if (isLocale(prefix)) return prefix;\n return 'en';\n}\n\n// ── Locale store ──\ninterface LocaleState {\n locale: Locale;\n setLocale: (locale: Locale) => void;\n}\n\nexport const useLocaleStore = create<LocaleState>((set) => ({\n locale: detectLocale(),\n setLocale: (locale) => set({ locale }),\n}));\n\nexport function getLocale(): Locale {\n return useLocaleStore.getState().locale;\n}\n\n// ── Translation function ──\nexport function t(key: TranslationKey, values?: Record<string, string | number>): string {\n const locale = useLocaleStore.getState().locale;\n let text: string = locales[locale][key] ?? locales['en'][key] ?? key;\n if (values) {\n for (const [k, v] of Object.entries(values)) {\n text = text.replaceAll(`{{${k}}}`, String(v));\n }\n }\n return text;\n}\n\n// ── Plural helper ──\nexport function tp(baseKey: string, count: number, values?: Record<string, string | number>): string {\n const suffix = count === 1 ? '_one' : '_other';\n return t(`${baseKey}${suffix}` as TranslationKey, { count, ...values });\n}\n\nexport type { TranslationKey, Translations };\n","const en = {\n // ── App chrome ──\n app_title: 'Brew-TUI',\n pro_badge: 'PRO',\n app_version: 'Brew-TUI v{{version}}',\n\n // ── View labels (header tab bar) ──\n view_dashboard: 'Dashboard',\n view_installed: 'Installed',\n view_search: 'Search',\n view_outdated: 'Outdated',\n view_packageInfo: 'Pkg Info',\n view_services: 'Services',\n view_doctor: 'Doctor',\n view_profiles: 'Profiles',\n view_smartCleanup: 'Cleanup',\n view_history: 'History',\n view_rollback: 'Rollback',\n view_brewfile: 'Brewfile',\n view_sync: 'Sync',\n view_securityAudit: 'Security',\n view_account: 'Account',\n\n // ── Keyboard hint actions ──\n hint_navigate: 'navigate',\n hint_next: 'next',\n hint_quit: 'quit',\n hint_filter: 'filter',\n hint_info: 'info',\n hint_toggle: 'toggle',\n hint_typeToSearch: 'type to search',\n hint_install: 'install',\n hint_uninstall: 'uninstall',\n hint_upgrade: 'upgrade',\n hint_upgradeAll: 'upgrade all',\n hint_back: 'back',\n hint_start: 'start',\n hint_stop: 'stop',\n hint_restart: 'restart',\n hint_refresh: 'refresh',\n hint_new: 'new',\n hint_details: 'details',\n hint_import: 'import',\n hint_delete: 'delete',\n hint_clean: 'clean',\n hint_all: 'all',\n hint_search: 'search',\n hint_clear: 'clear',\n hint_scan: 'scan',\n hint_expand: 'expand',\n hint_cancel: 'cancel',\n hint_force: 'force uninstall (ignore deps)',\n hint_rescan: 'rescan',\n hint_deactivate: 'deactivate',\n hint_promo: 'promo code',\n hint_importProfile: 'import this profile',\n hint_lang: 'lang',\n hint_replay: 'replay',\n hint_edit: 'edit',\n hint_pin: 'pin/unpin',\n hint_rollback_confirm: 'rollback',\n hint_add: 'add',\n hint_reconcile: 'reconcile',\n hint_export: 'export',\n hint_apply: 'apply',\n hint_revalidate: 'revalidate',\n hint_select: 'select',\n hint_sync: 'sync now',\n hint_conflict: 'resolve',\n hint_rollback: 'rollback',\n hint_check_compliance: 'check compliance',\n hint_switchTab: 'switch tab',\n hint_useLocal: 'use local',\n\n // ── Loading / progress ──\n loading_default: 'Loading...',\n loading_fetchingBrew: 'Fetching Homebrew data...',\n loading_installed: 'Loading installed packages...',\n loading_outdated: 'Checking for outdated packages...',\n loading_services: 'Loading services...',\n loading_doctor: 'Running brew doctor... (this may take a moment)',\n loading_profiles: 'Loading profiles...',\n loading_cleanup: 'Analyzing packages... (checking disk usage)',\n loading_history: 'Loading history...',\n loading_security: 'Scanning packages against OSV vulnerability database...',\n loading_searching: 'Searching...',\n loading_package: 'Loading {{name}}...',\n\n // ── Confirm dialog ──\n confirm_yes: '[Y]es',\n confirm_no: '[N]o',\n confirm_brewfile_reconcile: 'Reconcile Brewfile? Will install {{missing}} missing and reinstall {{wrongVer}} mismatched packages.',\n confirm_sync_now: 'Sync now with iCloud? This pushes local state and pulls remote changes.',\n confirm_sync_apply: 'Apply {{count}} conflict resolution(s)? Selected versions will be installed.',\n confirm_compliance_remediate: 'Remediate {{count}} actionable violation(s)? Will install missing packages and align mismatched versions.',\n\n // ── Error ──\n error_prefix: 'Error: ',\n\n // ── Common ──\n common_andMore: '...and {{count}} more',\n common_exit: '(exit {{code}})',\n common_yes: 'yes',\n common_no: 'no',\n\n // ── Relative time ──\n time_justNow: 'just now',\n time_minutesAgo: '{{n}}m ago',\n time_hoursAgo: '{{n}}h ago',\n time_daysAgo: '{{n}}d ago',\n time_monthsAgo: '{{n}}mo ago',\n\n // ── Badges ──\n badge_outdated: 'outdated',\n badge_pinned: 'pinned',\n badge_kegOnly: 'keg-only',\n badge_dep: 'dep',\n badge_installed: 'installed',\n badge_deprecated: 'deprecated',\n badge_ok: 'ok',\n badge_fail: 'fail',\n badge_error: 'error',\n\n // ── Dashboard ──\n dashboard_pro_status: 'Pro Status',\n dashboard_security: 'Security',\n dashboard_cves: '{{count}} CVEs',\n dashboard_no_cves: 'No CVEs',\n dashboard_brewfile: 'Brewfile',\n dashboard_sync: 'Sync',\n dashboard_sync_never: 'Never synced',\n dashboard_sync_ago: '{{time}} ago',\n dashboard_compliance: 'Compliance',\n dashboard_compliance_violations: '{{count}} violations',\n dashboard_compliance_ok: 'OK',\n dashboard_overview: 'Overview',\n dashboard_formulae: 'Formulae',\n dashboard_casks: 'Casks',\n dashboard_outdated: 'Outdated',\n dashboard_services: 'Services',\n dashboard_systemInfo: 'System Info',\n dashboard_homebrew: 'Homebrew:',\n dashboard_prefix: 'Prefix:',\n dashboard_updated: 'Updated:',\n dashboard_outdatedPackages: 'Outdated Packages',\n dashboard_serviceErrors: 'Service Errors',\n dashboard_partialData: 'Some Homebrew sections failed to load:',\n dashboard_statError: 'ERR',\n\n // ── Installed ──\n installed_formulaeCount: 'Formulae ({{count}})',\n installed_casksCount: 'Casks ({{count}})',\n installed_filterDisplay: 'Filter: \"{{query}}\" ({{count}} matches)',\n installed_noPackages: 'No packages found',\n installed_confirmUninstall: 'Uninstall {{name}}?',\n\n // ── Search ──\n search_placeholder: 'Search Homebrew packages... (enter to search)',\n search_resultsFor: 'Results for',\n search_escToClear: '(esc to clear)',\n search_installing: 'Installing package...',\n search_installComplete: 'Installation complete!',\n search_confirmInstall: 'Install {{name}}?',\n search_formulaeHeader: '=== Formulae ({{count}})',\n search_casksHeader: '=== Casks ({{count}})',\n search_noResults: 'No results found',\n search_minChars: 'Type at least 2 characters to search.',\n\n // ── Outdated ──\n outdated_title: 'Outdated Packages ({{count}})',\n outdated_upgrading: 'Upgrading...',\n outdated_upgradeComplete: 'Upgrade complete!',\n outdated_pressRefresh: '(press r to refresh)',\n outdated_upToDate: 'Everything is up to date!',\n outdated_confirmAll: 'Upgrade all {{count}} packages?',\n outdated_confirmSingle: 'Upgrade {{name}}?',\n outdated_pinned: '[pinned]',\n\n // ── Package Info ──\n pkgInfo_noPackage: 'No package selected. Go to Installed and press Enter on a package.',\n pkgInfo_notFound: 'Package not found',\n pkgInfo_installing: 'Installing {{name}}...',\n pkgInfo_uninstalling: 'Uninstalling {{name}}...',\n pkgInfo_upgrading: 'Upgrading {{name}}...',\n pkgInfo_done: 'Done!',\n pkgInfo_confirmInstall: 'install {{name}}?',\n pkgInfo_confirmUninstall: 'uninstall {{name}}?',\n pkgInfo_confirmUpgrade: 'upgrade {{name}}?',\n pkgInfo_details: 'Details',\n pkgInfo_homepage: 'Homepage:',\n pkgInfo_license: 'License:',\n pkgInfo_tap: 'Tap:',\n pkgInfo_stable: 'Stable:',\n pkgInfo_installed: 'Installed:',\n pkgInfo_bottle: 'Bottle:',\n pkgInfo_onRequest: 'On request:',\n pkgInfo_noDependency: 'no (dependency)',\n pkgInfo_dependencies: 'Dependencies ({{count}})',\n pkgInfo_caveats: 'Caveats',\n\n // ── Services ──\n services_title: 'Homebrew Services',\n services_titleCount: 'Homebrew Services ({{count}})',\n services_noServices: 'No services found',\n services_name: 'Name',\n services_status: 'Status',\n services_user: 'User',\n services_processing: 'Processing...',\n services_confirmStop: 'Stop service {{name}}?',\n services_confirmRestart: 'Restart service {{name}}?',\n\n // ── Doctor ──\n doctor_title: 'Homebrew Doctor',\n doctor_clean: 'Your system is ready to brew.',\n doctor_warningsNotCaptured: 'Doctor finished with warnings but none were captured.',\n\n // ── Profiles ──\n profiles_title: 'Package Profiles ({{count}})',\n profiles_importTitle: 'Importing profile...',\n profiles_importComplete: 'Import complete. Press any key.',\n profiles_importPartial: 'Import finished with errors. Check the log above.',\n profiles_createName: 'Create Profile \\u2014 Name:',\n profiles_namePlaceholder: 'e.g. work, personal, project-x',\n profiles_createDesc: 'Create Profile \"{{name}}\" \\u2014 Description:',\n profiles_descPlaceholder: 'Brief description of this setup',\n profiles_created: 'Created: {{date}}',\n profiles_formulaeCount: 'Formulae ({{count}})',\n profiles_casksCount: 'Casks ({{count}})',\n profiles_confirmDelete: 'Delete profile \"{{name}}\"?',\n profiles_noProfiles: 'No profiles saved yet.',\n profiles_press: 'Press',\n profiles_exportHint: 'to export your current setup as a profile.',\n profiles_editName: 'Edit Profile \\u2014 Name:',\n profiles_editDesc: 'Edit Profile \"{{name}}\" \\u2014 Description:',\n\n // ── Smart Cleanup ──\n cleanup_title: 'Smart Cleanup',\n cleanup_cleaning: 'Cleaning up...',\n cleanup_complete: 'Cleanup complete! Press r to re-analyze.',\n cleanup_orphans: 'Orphans',\n cleanup_reclaimable: 'Reclaimable',\n cleanup_selected: 'Selected',\n cleanup_confirmUninstall: 'Uninstall {{count}} packages?',\n cleanup_confirmForce: 'Some packages have dependencies. Force uninstall {{count}} packages? (ignores dependencies)',\n cleanup_depError: 'Some packages could not be removed due to dependencies.',\n cleanup_systemClean: 'No orphaned packages found. Your system is clean!',\n\n // ── History ──\n history_title: 'Action History ({{count}})',\n history_filterLabel: 'filter: {{filter}}',\n history_searchPlaceholder: 'Search packages...',\n history_confirmClear: 'Clear all {{count}} history entries?',\n history_noEntries: 'No history entries',\n history_noEntriesFor: 'No history entries for \"{{filter}}\"',\n history_all: '(all)',\n history_actionInstall: 'install',\n history_actionUninstall: 'uninstall',\n history_actionUpgrade: 'upgrade',\n history_actionUpgradeAll: 'upgrade-all',\n history_confirmReplay: 'Re-run: {{action}} {{name}}?',\n history_replayAll: 'Re-run: upgrade all packages?',\n\n // ── Security Audit ──\n security_rollback_hint: 'R: open Rollback for version restoration',\n security_title: 'Security Audit',\n security_scanned: 'Scanned',\n security_vulnerable: 'Vulnerable',\n security_critical: 'Critical',\n security_high: 'High',\n security_medium: 'Medium',\n security_noVulns: 'No known vulnerabilities found in your installed packages!',\n security_fixedIn: 'Fixed in: {{version}}',\n security_confirmUpgrade: 'Upgrade {{name}} to fix vulnerabilities?',\n\n // ── Account ──\n account_title: 'Account & License',\n account_confirmDeactivate: 'Deactivate your Pro license on this machine?',\n account_statusLabel: 'Status:',\n account_pro: '[Pro]',\n account_free: '[Free]',\n account_expired: '[Expired]',\n account_validating: '[Validating...]',\n account_emailLabel: 'Email:',\n account_nameLabel: 'Name:',\n account_planLabel: 'Plan:',\n account_monthlyPrice: '9.95\\u20AC/month',\n account_yearlyPrice: '82\\u20AC/year',\n account_keyLabel: 'Key:',\n account_expiresLabel: 'Expires:',\n account_activatedLabel: 'Activated:',\n account_upgradeTitle: 'Upgrade to Brew-TUI Pro',\n account_unlockDesc: 'Unlock Profiles, Smart Cleanup, History, Security Audit, and BrewBar (macOS menu bar companion).',\n account_pricing: '9.95\\u20AC/month or 82\\u20AC/year (save 31%)',\n account_runActivate: 'Run:',\n account_activateCmd: 'brew-tui activate <key>',\n account_licenseExpired: 'Your license has expired. Renew to continue using Pro features.',\n account_deactivating: 'Deactivating...',\n account_loading: 'Loading license status...',\n account_revalidating: 'Revalidating with server...',\n account_promoTitle: 'Redeem Promo Code',\n account_promoLabel: 'Code:',\n account_promoValidating: 'Validating promo code...',\n account_promoSuccess: 'Promo code redeemed! Pro access until {{expires}}.',\n account_promoInvalid: 'Invalid or expired promo code.',\n account_promoError: 'Could not validate promo code. Check your connection.',\n account_promoEsc: 'esc: cancel',\n account_promoHint: 'p: redeem promo code',\n\n // ── Upgrade Prompt ──\n upgrade_proFeature: '{{title}} \\u2014 Pro Feature',\n upgrade_profiles: 'Package Profiles',\n upgrade_profilesDesc: 'Export and import your Homebrew setup across machines. Save named profiles for work, personal, or project-specific configurations.',\n upgrade_cleanup: 'Smart Cleanup',\n upgrade_cleanupDesc: 'Find orphaned packages, analyze disk usage per package, and reclaim disk space with one-click intelligent cleanup.',\n upgrade_history: 'Action History',\n upgrade_historyDesc: 'Track every install, uninstall, and upgrade with timestamps. Search and filter your package management history.',\n upgrade_security: 'Security Audit',\n upgrade_securityDesc: 'Scan installed packages against known vulnerabilities (CVEs). See severity levels, affected versions, and available fixes.',\n upgrade_pricing: '9.95\\u20AC/month or 82\\u20AC/year (save 31%)',\n upgrade_teamFeature: '{{title}} \\u2014 Team tier',\n upgrade_teamPricing: '8\\u20AC/seat/month or 81.60\\u20AC/seat/year (save 15%) \\u2014 from 3 seats',\n upgrade_buyAt: 'Buy at:',\n upgrade_buyUrl: 'https://buy.polar.sh/polar_cl_yQsiUeDelyyEQznbWffD1j77JAyP24ra7iEVQ22PA4h',\n upgrade_buyUrlTeam: 'https://buy.polar.sh/polar_cl_CO6xqSzKgFiQJwXnhZYGqisOP04Wspi0KKZSn38NjFZ?quantity=3',\n upgrade_activateWith: 'Then activate with:',\n upgrade_activateCmd: 'brew-tui activate <your-license-key>',\n upgrade_proLabel: 'Brew-TUI Pro \\u2014 9.95\\u20AC/month or 82\\u20AC/year \\u2014 Includes BrewBar for macOS',\n upgrade_teamLabel: 'Brew-TUI Team \\u2014 8\\u20AC/seat/month \\u2014 Includes everything in Pro plus Compliance',\n\n // ── Progress Log ──\n progress_noOutput: 'No output yet',\n\n // ── Search Input ──\n searchInput_placeholder: 'Type to filter...',\n\n // ── Profile Manager ──\n profileMgr_tapping: 'Tapping {{name}}...',\n profileMgr_installing: 'Installing {{name}}...',\n profileMgr_installingCask: 'Installing cask {{name}}...',\n profileMgr_importDone: 'Done! Installed {{count}} packages.',\n\n // ── CLI ──\n cli_usageActivate: 'Usage: brew-tui activate <license-key>',\n cli_activated: '\\u2714 Pro activated for {{email}}',\n cli_plan: ' Plan: {{plan}}',\n cli_expires: ' Expires: {{date}}',\n cli_activationFailed: '\\u2718 Activation failed: {{error}}',\n cli_noLicense: 'No active license found.',\n cli_deactivated: '\\u2714 License deactivated.',\n cli_planFree: 'Plan: Free',\n cli_planPro: 'Plan: Pro',\n cli_planExpired: 'Plan: Expired',\n cli_confirmDeactivate: 'Deactivate your Pro license on this machine? (y/N): ',\n cli_deactivateCancelled: 'Deactivation cancelled.',\n cli_upgradeHint: 'Run `brew-tui activate <key>` to upgrade to Pro.',\n cli_revalidateHint: 'Run `brew-tui revalidate` to refresh your current license.',\n cli_email: 'Email: {{email}}',\n cli_status: 'Status: {{status}}',\n cli_revalidated: '\\u2714 License revalidated.',\n cli_revalidateGrace: '\\u26A0 Could not reach the server. Your current license remains usable within the offline grace period.',\n cli_revalidateFailed: '\\u2718 License revalidation failed. Renew your subscription or activate a valid key.',\n cli_rateLimited: 'Too many activation attempts. Try again in {{minutes}} minutes.',\n cli_cooldown: 'Please wait before trying again.',\n cli_brewbarInstalling: 'Downloading BrewBar...',\n cli_brewbarInstalled: '\\u2714 BrewBar installed to /Applications/BrewBar.app',\n cli_brewbarAlreadyInstalled: 'BrewBar is already installed. Use --force to reinstall.',\n cli_brewbarUninstalled: '\\u2714 BrewBar removed from /Applications.',\n cli_brewbarNotInstalled: 'BrewBar is not installed.',\n cli_brewbarProRequired: '\\u2718 BrewBar requires a Pro license.\\n Run: brew-tui activate <key>',\n cli_brewbarRevalidateRequired: '\\u2718 BrewBar requires a valid Pro license.\\n Run: brew-tui revalidate',\n cli_brewbarMacOnly: '\\u2718 BrewBar is only available on macOS.',\n cli_brewbarDownloadFailed: '\\u2718 Failed to download BrewBar: {{error}}',\n cli_brewbarAutoFailed: '\\u26A0 BrewBar auto-launch failed: {{error}}',\n cli_deactivateRemoteFailed: '\\u26A0 Warning: Could not reach the server to deactivate remotely. The license was removed locally but may still count as active.',\n\n // ── License degradation (Layer 15) ──\n license_offlineWarning: 'Your license has not been validated for {{days}} days. Please connect to the internet.',\n\n // ── Plurals ──\n plural_vulns_one: '({{count}} vuln)',\n plural_vulns_other: '({{count}} vulns)',\n plural_warnings_one: '{{count}} warning',\n plural_warnings_other: '{{count}} warnings',\n\n // ── Scroll indicators ──\n scroll_moreAbove: '\\u2191 {{count}} more',\n scroll_moreBelow: '\\u2193 {{count}} more',\n\n // ── SCR-001: Cleanup warning ──\n cleanup_warning_system_tools: 'Warning: detected orphans may include dependencies of tools not managed by Homebrew. Review the list before proceeding.',\n\n // ── SCR-002: Installed column headers ──\n installed_col_package: 'Package',\n installed_col_version: 'Version',\n installed_col_status: 'Status',\n\n // ── SCR-003: Search failed ──\n search_failed: 'Search failed',\n\n // ── SCR-007: Deactivate failed ──\n deactivate_failed: 'Deactivation failed',\n\n // ── ACC-005: Version labels ──\n version_installed: 'installed:',\n version_available: 'available:',\n\n // ── SCR-006: Upgrade-all replay warning ──\n upgrade_all_warning: 'Note: this will upgrade all currently outdated packages, which may differ from the original set.',\n\n // ── SEG-007: Delete account ──\n delete_account_confirm: 'Delete all Brew-TUI data (~/.brew-tui)? This removes your license, profiles, and history. This cannot be undone.',\n delete_account_success: 'All Brew-TUI data has been removed.',\n\n // ── SCR-012: Upgrade All packages list ──\n outdated_upgradeAllList: 'Packages to upgrade: {{list}}',\n\n // ── SCR-005: Profile import summary ──\n profiles_importSummary: 'This profile contains {{formulae}} formulae and {{casks}} casks. Continue?',\n\n // ── SCR-017: Network error ��─\n security_networkError: 'Could not reach OSV.dev vulnerability database. Check your internet connection.',\n\n // ── ARQ-004: Dashboard last updated ──\n dashboard_lastUpdated: 'Last updated: {{time}}',\n\n // ── SCR-014: Services last error ──\n services_lastError: 'Last error: {{error}}',\n\n // ── SCR-010: Generic network error ──\n error_network: 'Network error: unable to reach the server.',\n\n // ── ARQ-005: Security cache ──\n security_cachedResults: 'Showing cached results ({{time}} ago). Press r to rescan.',\n\n // ── Impact Analysis ──\n impact_brewfile_hint: '\\u{1F4A1} Add to Brewfile to pin this version before upgrading',\n impact_analyzing: 'Analyzing upgrade impact...',\n impact_high: 'HIGH RISK',\n impact_medium: 'MEDIUM RISK',\n impact_low: 'LOW RISK',\n impact_affects: 'affects {{count}} installed packages',\n impact_usedBy: 'Used by: {{packages}}',\n impact_hint: 'Select package to see upgrade impact',\n impact_reason_critical_package: 'Critical system package',\n impact_reason_major_bump: 'Major version change',\n impact_reason_many_deps: '{{count}} packages depend on this',\n\n // ── Rollback ──\n rollback_title: 'Rollback \\u2014 Restore Previous State',\n rollback_no_snapshots: 'No snapshots available. Snapshots are captured automatically after each operation.',\n rollback_select_snapshot: 'Select a snapshot to restore',\n rollback_snapshot_label: '{{label}} \\u2014 {{date}}',\n rollback_snapshot_auto: 'Auto',\n rollback_diff_empty: 'No changes detected between this snapshot and current state',\n rollback_confirm: 'Roll back {{count}} package(s) to this state?',\n rollback_strategy_bottle: 'from bottle cache',\n rollback_strategy_versioned: 'from versioned formula',\n rollback_strategy_pin: 'pin only (version not restorable)',\n rollback_strategy_unavailable: 'cannot restore',\n rollback_executing: 'Rolling back...',\n rollback_success: 'Rollback completed',\n rollback_error: 'Rollback failed: {{error}}',\n rollback_item_downgrade: '{{name}}: {{from}} \\u2192 {{to}}',\n rollback_item_remove: 'Remove: {{name}}',\n rollback_item_install: 'Install: {{name}} {{version}}',\n rollback_warning_cask: 'Casks will be pinned only (version restoration not supported)',\n rollback_capturing: 'Capturing current snapshot...',\n\n // ── Sync ──\n sync_title: 'Cross-machine Sync',\n sync_disabled: 'Sync is not configured. Press s to set up iCloud sync.',\n sync_status_ok: 'In sync',\n sync_status_drift: '{{count}} change(s) from other machines',\n sync_status_conflict: '{{count}} conflict(s) need resolution',\n sync_last_sync: 'Last sync: {{date}}',\n sync_machine: 'This machine: {{name}}',\n sync_other_machines: 'Other machines: {{names}}',\n sync_syncing: 'Syncing...',\n sync_success: 'Sync complete',\n sync_error: 'Sync failed: {{error}}',\n sync_conflict_title: 'Conflict: {{package}}',\n sync_conflict_local: 'This machine: {{version}}',\n sync_conflict_remote: '{{machine}}: {{version}}',\n sync_conflict_use_local: 'Keep local',\n sync_conflict_use_remote: 'Use remote',\n sync_setup_icloud: 'Setting up iCloud sync...',\n sync_no_icloud: 'iCloud Drive not found. Ensure iCloud Drive is enabled in System Settings.',\n\n // ── Upgrade Prompt — Sync ──\n upgrade_sync: 'Cross-machine Sync',\n upgrade_syncDesc: 'Keep your Homebrew setup in sync across multiple Macs via iCloud Drive. Automatically merge installations and resolve conflicts.',\n\n // ── Brewfile ──\n brewfile_title: 'Declarative Brewfile',\n brewfile_compliant: 'compliant',\n brewfile_no_brewfile: 'No Brewfile found. Press n to create one from your current installation.',\n brewfile_create_name: 'Brewfile name (Enter to confirm):',\n brewfile_created: 'Brewfile created: {{name}}',\n brewfile_drift_missing: '{{count}} packages missing',\n brewfile_drift_extra: '{{count}} extra packages',\n brewfile_drift_wrong: '{{count}} wrong versions',\n brewfile_reconciling: 'Reconciling...',\n brewfile_reconcile_success: 'Reconciliation complete',\n brewfile_reconcile_error: 'Reconciliation failed: {{error}}',\n brewfile_exported: 'Exported to {{path}}',\n brewfile_formulae_count: '{{count}} formulae',\n brewfile_casks_count: '{{count}} casks',\n brewfile_strict_mode: 'Strict mode',\n brewfile_in_sync: '✓ System is in sync with Brewfile',\n brewfile_computing_drift: 'Computing drift...',\n\n // ── Compliance ──\n view_compliance: 'Compliance',\n compliance_title: 'Team Compliance',\n compliance_no_policy: 'No policy loaded. Press i to import a policy file.',\n compliance_score: '{{score}}% compliant',\n compliance_violations: '{{count}} violation(s)',\n compliance_ok: 'Fully compliant',\n compliance_import_prompt: 'Policy file path (Enter to confirm):',\n compliance_import_error: 'Failed to load policy: {{error}}',\n compliance_violation_missing: 'Missing: {{name}} (required)',\n compliance_violation_forbidden: 'Forbidden: {{name}} — {{reason}}',\n compliance_violation_version: 'Wrong version: {{name}} (required {{required}}, installed {{installed}})',\n compliance_violation_extra: 'Extra package: {{name}}',\n compliance_remediating: 'Remediating...',\n compliance_remediate_success: 'Remediation complete',\n compliance_remediate_error: 'Remediation failed: {{error}}',\n compliance_export_done: 'Report exported to {{path}}',\n compliance_press_r_hint: 'Press r to run compliance check.',\n compliance_machine: 'Machine: {{name}}',\n compliance_policy_name: 'Policy: {{name}}',\n compliance_policy_by: 'Maintained by: {{maintainer}}',\n\n // ── Upgrade Prompt — Compliance ──\n upgrade_compliance: 'Team Compliance',\n upgrade_complianceDesc: 'Enforce package policies across your team. Define required, forbidden, and version-pinned packages and automatically remediate deviations.',\n\n // ── Upgrade Prompt — Rollback / Brewfile ──\n upgrade_rollback: 'Smart Rollback',\n upgrade_rollbackDesc: 'Restore your Homebrew state from any past snapshot. Brew-TUI captures a snapshot before every install and upgrade so you can roll back a bad update with one keystroke.',\n upgrade_brewfile: 'Declarative Brewfile',\n upgrade_brewfileDesc: 'Pin your toolchain in a versioned Brewfile and reconcile any machine to it. Drift score, missing/extra detection and one-keystroke alignment.',\n};\n\nexport default en;\nexport type Translations = { [K in keyof typeof en]: string };\nexport type TranslationKey = keyof typeof en;\n","import type { Translations } from './en.js';\n\nconst es: Translations = {\n // ── App chrome ──\n app_title: 'Brew-TUI',\n pro_badge: 'PRO',\n app_version: 'Brew-TUI v{{version}}',\n\n // ── View labels (header tab bar) ──\n view_dashboard: 'Inicio',\n view_installed: 'Instalados',\n view_search: 'Buscar',\n view_outdated: 'Desactual.',\n view_packageInfo: 'Info Paq.',\n view_services: 'Servicios',\n view_doctor: 'Doctor',\n view_profiles: 'Perfiles',\n view_smartCleanup: 'Limpieza',\n view_history: 'Historial',\n view_rollback: 'Rollback',\n view_brewfile: 'Brewfile',\n view_sync: 'Sync',\n view_securityAudit: 'Seguridad',\n view_account: 'Cuenta',\n\n // ── Keyboard hint actions ──\n hint_navigate: 'navegar',\n hint_next: 'siguiente',\n hint_quit: 'salir',\n hint_filter: 'filtrar',\n hint_info: 'info',\n hint_toggle: 'cambiar',\n hint_typeToSearch: 'escribe para buscar',\n hint_install: 'instalar',\n hint_uninstall: 'desinstalar',\n hint_upgrade: 'actualizar',\n hint_upgradeAll: 'actualizar todo',\n hint_back: 'volver',\n hint_start: 'iniciar',\n hint_stop: 'detener',\n hint_restart: 'reiniciar',\n hint_refresh: 'refrescar',\n hint_new: 'nuevo',\n hint_details: 'detalles',\n hint_import: 'importar',\n hint_delete: 'eliminar',\n hint_clean: 'limpiar',\n hint_all: 'todo',\n hint_search: 'buscar',\n hint_clear: 'borrar',\n hint_scan: 'escanear',\n hint_expand: 'expandir',\n hint_cancel: 'cancelar',\n hint_force: 'forzar (ignorar deps)',\n hint_rescan: 're-escanear',\n hint_deactivate: 'desactivar',\n hint_promo: 'c\\u00F3digo promo',\n hint_importProfile: 'importar este perfil',\n hint_lang: 'idioma',\n hint_replay: 'repetir',\n hint_edit: 'editar',\n hint_pin: 'fijar/desfijar',\n hint_rollback_confirm: 'revertir',\n hint_add: 'a\\u00F1adir',\n hint_reconcile: 'reconciliar',\n hint_export: 'exportar',\n hint_apply: 'aplicar',\n hint_revalidate: 'revalidar',\n hint_select: 'seleccionar',\n hint_sync: 'sincronizar',\n hint_conflict: 'resolver',\n hint_rollback: 'revertir',\n hint_check_compliance: 'verificar conformidad',\n hint_switchTab: 'cambiar pestaña',\n hint_useLocal: 'usar local',\n\n // ── Loading / progress ──\n loading_default: 'Cargando...',\n loading_fetchingBrew: 'Obteniendo datos de Homebrew...',\n loading_installed: 'Cargando paquetes instalados...',\n loading_outdated: 'Buscando paquetes desactualizados...',\n loading_services: 'Cargando servicios...',\n loading_doctor: 'Ejecutando brew doctor... (puede tardar un momento)',\n loading_profiles: 'Cargando perfiles...',\n loading_cleanup: 'Analizando paquetes... (verificando uso de disco)',\n loading_history: 'Cargando historial...',\n loading_security: 'Escaneando paquetes en la base de datos de vulnerabilidades OSV...',\n loading_searching: 'Buscando...',\n loading_package: 'Cargando {{name}}...',\n\n // ── Confirm dialog ──\n confirm_yes: '[S]\\u00ED',\n confirm_no: '[N]o',\n confirm_brewfile_reconcile: '¿Reconciliar Brewfile? Instalará {{missing}} paquetes faltantes y reinstalará {{wrongVer}} con versión incorrecta.',\n confirm_sync_now: '¿Sincronizar ahora con iCloud? Se subirá el estado local y se descargarán los cambios remotos.',\n confirm_sync_apply: '¿Aplicar {{count}} resolución(es) de conflicto? Se instalarán las versiones seleccionadas.',\n confirm_compliance_remediate: '¿Remediar {{count}} violación(es) accionable(s)? Se instalarán los paquetes faltantes y se alinearán las versiones desviadas.',\n\n // ── Error ──\n error_prefix: 'Error: ',\n\n // ── Common ──\n common_andMore: '...y {{count}} m\\u00E1s',\n common_exit: '(salida {{code}})',\n common_yes: 's\\u00ED',\n common_no: 'no',\n\n // ── Relative time ──\n time_justNow: 'ahora',\n time_minutesAgo: 'hace {{n}}m',\n time_hoursAgo: 'hace {{n}}h',\n time_daysAgo: 'hace {{n}}d',\n time_monthsAgo: 'hace {{n}}me',\n\n // ── Badges ──\n badge_outdated: 'desactualizado',\n badge_pinned: 'fijado',\n badge_kegOnly: 'keg-only',\n badge_dep: 'dep',\n badge_installed: 'instalado',\n badge_deprecated: 'obsoleto',\n badge_ok: 'ok',\n badge_fail: 'fallo',\n badge_error: 'error',\n\n // ── Dashboard ──\n dashboard_pro_status: 'Estado Pro',\n dashboard_security: 'Seguridad',\n dashboard_cves: '{{count}} CVEs',\n dashboard_no_cves: 'Sin CVEs',\n dashboard_brewfile: 'Brewfile',\n dashboard_sync: 'Sync',\n dashboard_sync_never: 'Nunca sincronizado',\n dashboard_sync_ago: 'hace {{time}}',\n dashboard_compliance: 'Conformidad',\n dashboard_compliance_violations: '{{count}} violaciones',\n dashboard_compliance_ok: 'OK',\n dashboard_overview: 'Resumen',\n dashboard_formulae: 'Formulae',\n dashboard_casks: 'Casks',\n dashboard_outdated: 'Desactualizados',\n dashboard_services: 'Servicios',\n dashboard_systemInfo: 'Info del Sistema',\n dashboard_homebrew: 'Homebrew:',\n dashboard_prefix: 'Prefijo:',\n dashboard_updated: 'Actualizado:',\n dashboard_outdatedPackages: 'Paquetes Desactualizados',\n dashboard_serviceErrors: 'Errores de Servicios',\n dashboard_partialData: 'Algunas secciones de Homebrew no pudieron cargarse:',\n dashboard_statError: 'ERR',\n\n // ── Installed ──\n installed_formulaeCount: 'Formulae ({{count}})',\n installed_casksCount: 'Casks ({{count}})',\n installed_filterDisplay: 'Filtro: \"{{query}}\" ({{count}} coincidencias)',\n installed_noPackages: 'No se encontraron paquetes',\n installed_confirmUninstall: '\\u00BFDesinstalar {{name}}?',\n\n // ── Search ──\n search_placeholder: 'Buscar paquetes Homebrew... (enter para buscar)',\n search_resultsFor: 'Resultados para',\n search_escToClear: '(esc para limpiar)',\n search_installing: 'Instalando paquete...',\n search_installComplete: '\\u00A1Instalaci\\u00F3n completa!',\n search_confirmInstall: '\\u00BFInstalar {{name}}?',\n search_formulaeHeader: '=== Formulae ({{count}})',\n search_casksHeader: '=== Casks ({{count}})',\n search_noResults: 'Sin resultados',\n search_minChars: 'Escribe al menos 2 caracteres para buscar.',\n\n // ── Outdated ──\n outdated_title: 'Paquetes Desactualizados ({{count}})',\n outdated_upgrading: 'Actualizando...',\n outdated_upgradeComplete: '\\u00A1Actualizaci\\u00F3n completa!',\n outdated_pressRefresh: '(presiona r para refrescar)',\n outdated_upToDate: '\\u00A1Todo est\\u00E1 al d\\u00EDa!',\n outdated_confirmAll: '\\u00BFActualizar los {{count}} paquetes?',\n outdated_confirmSingle: '\\u00BFActualizar {{name}}?',\n outdated_pinned: '[fijado]',\n\n // ── Package Info ──\n pkgInfo_noPackage: 'Ning\\u00FAn paquete seleccionado. Ve a Instalados y presiona Enter en un paquete.',\n pkgInfo_notFound: 'Paquete no encontrado',\n pkgInfo_installing: 'Instalando {{name}}...',\n pkgInfo_uninstalling: 'Desinstalando {{name}}...',\n pkgInfo_upgrading: 'Actualizando {{name}}...',\n pkgInfo_done: '\\u00A1Listo!',\n pkgInfo_confirmInstall: '\\u00BFinstalar {{name}}?',\n pkgInfo_confirmUninstall: '\\u00BFdesinstalar {{name}}?',\n pkgInfo_confirmUpgrade: '\\u00BFactualizar {{name}}?',\n pkgInfo_details: 'Detalles',\n pkgInfo_homepage: 'Web:',\n pkgInfo_license: 'Licencia:',\n pkgInfo_tap: 'Tap:',\n pkgInfo_stable: 'Estable:',\n pkgInfo_installed: 'Instalado:',\n pkgInfo_bottle: 'Bottle:',\n pkgInfo_onRequest: 'Por solicitud:',\n pkgInfo_noDependency: 'no (dependencia)',\n pkgInfo_dependencies: 'Dependencias ({{count}})',\n pkgInfo_caveats: 'Advertencias',\n\n // ── Services ──\n services_title: 'Servicios Homebrew',\n services_titleCount: 'Servicios Homebrew ({{count}})',\n services_noServices: 'No se encontraron servicios',\n services_name: 'Nombre',\n services_status: 'Estado',\n services_user: 'Usuario',\n services_processing: 'Procesando...',\n services_confirmStop: '\\u00BFDetener servicio {{name}}?',\n services_confirmRestart: '\\u00BFReiniciar servicio {{name}}?',\n\n // ── Doctor ──\n doctor_title: 'Homebrew Doctor',\n doctor_clean: 'Tu sistema est\\u00E1 listo para brew.',\n doctor_warningsNotCaptured: 'Doctor termin\\u00F3 con advertencias pero no se capturaron.',\n\n // ── Profiles ──\n profiles_title: 'Perfiles de Paquetes ({{count}})',\n profiles_importTitle: 'Importando perfil...',\n profiles_importComplete: 'Importaci\\u00F3n completa. Presiona cualquier tecla.',\n profiles_importPartial: 'Importaci\\u00F3n finalizada con errores. Revisa el registro arriba.',\n profiles_createName: 'Crear Perfil \\u2014 Nombre:',\n profiles_namePlaceholder: 'ej. trabajo, personal, proyecto-x',\n profiles_createDesc: 'Crear Perfil \"{{name}}\" \\u2014 Descripci\\u00F3n:',\n profiles_descPlaceholder: 'Breve descripci\\u00F3n de esta configuraci\\u00F3n',\n profiles_created: 'Creado: {{date}}',\n profiles_formulaeCount: 'Formulae ({{count}})',\n profiles_casksCount: 'Casks ({{count}})',\n profiles_confirmDelete: '\\u00BFEliminar perfil \"{{name}}\"?',\n profiles_noProfiles: 'A\\u00FAn no hay perfiles guardados.',\n profiles_press: 'Presiona',\n profiles_exportHint: 'para exportar tu configuraci\\u00F3n actual como perfil.',\n profiles_editName: 'Editar Perfil \\u2014 Nombre:',\n profiles_editDesc: 'Editar Perfil \"{{name}}\" \\u2014 Descripci\\u00F3n:',\n\n // ── Smart Cleanup ──\n cleanup_title: 'Limpieza Inteligente',\n cleanup_cleaning: 'Limpiando...',\n cleanup_complete: '\\u00A1Limpieza completa! Presiona r para re-analizar.',\n cleanup_orphans: 'Hu\\u00E9rfanos',\n cleanup_reclaimable: 'Recuperable',\n cleanup_selected: 'Seleccionados',\n cleanup_confirmUninstall: '\\u00BFDesinstalar {{count}} paquetes?',\n cleanup_confirmForce: 'Algunos paquetes tienen dependencias. \\u00BFForzar desinstalaci\\u00F3n de {{count}} paquetes? (ignora dependencias)',\n cleanup_depError: 'Algunos paquetes no pudieron eliminarse por dependencias.',\n cleanup_systemClean: '\\u00A1No se encontraron paquetes hu\\u00E9rfanos. Tu sistema est\\u00E1 limpio!',\n\n // ── History ──\n history_title: 'Historial de Acciones ({{count}})',\n history_filterLabel: 'filtro: {{filter}}',\n history_searchPlaceholder: 'Buscar paquetes...',\n history_confirmClear: '\\u00BFBorrar las {{count}} entradas del historial?',\n history_noEntries: 'Sin entradas en el historial',\n history_noEntriesFor: 'Sin entradas en el historial para \"{{filter}}\"',\n history_all: '(todos)',\n history_actionInstall: 'instalar',\n history_actionUninstall: 'desinstalar',\n history_actionUpgrade: 'actualizar',\n history_actionUpgradeAll: 'actualizar-todo',\n history_confirmReplay: '\\u00BFRe-ejecutar: {{action}} {{name}}?',\n history_replayAll: '\\u00BFRe-ejecutar: actualizar todos los paquetes?',\n\n // ── Security Audit ──\n security_title: 'Auditor\\u00EDa de Seguridad',\n security_scanned: 'Escaneados',\n security_vulnerable: 'Vulnerables',\n security_critical: 'Cr\\u00EDticos',\n security_high: 'Altos',\n security_medium: 'Medios',\n security_noVulns: '\\u00A1No se encontraron vulnerabilidades conocidas en tus paquetes instalados!',\n security_fixedIn: 'Corregido en: {{version}}',\n security_confirmUpgrade: '\\u00BFActualizar {{name}} para corregir vulnerabilidades?',\n\n // ── Account ──\n account_title: 'Cuenta y Licencia',\n account_confirmDeactivate: '\\u00BFDesactivar tu licencia Pro en esta m\\u00E1quina?',\n account_statusLabel: 'Estado:',\n account_pro: '[Pro]',\n account_free: '[Gratis]',\n account_expired: '[Expirada]',\n account_validating: '[Validando...]',\n account_emailLabel: 'Email:',\n account_nameLabel: 'Nombre:',\n account_planLabel: 'Plan:',\n account_monthlyPrice: '9,95\\u20AC/mes',\n account_yearlyPrice: '82\\u20AC/a\\u00F1o',\n account_keyLabel: 'Clave:',\n account_expiresLabel: 'Expira:',\n account_activatedLabel: 'Activado:',\n account_upgradeTitle: 'Actualiza a Brew-TUI Pro',\n account_unlockDesc: 'Desbloquea Perfiles, Limpieza Inteligente, Historial, Auditor\\u00EDa de Seguridad y BrewBar (barra de men\\u00FA macOS).',\n account_pricing: '9,95\\u20AC/mes o 82\\u20AC/a\\u00F1o (ahorra 31%)',\n account_runActivate: 'Ejecuta:',\n account_activateCmd: 'brew-tui activate <clave>',\n account_licenseExpired: 'Tu licencia ha expirado. Renueva para seguir usando las funciones Pro.',\n account_deactivating: 'Desactivando...',\n account_loading: 'Cargando estado de la licencia...',\n account_revalidating: 'Revalidando con el servidor...',\n account_promoTitle: 'Canjear C\\u00F3digo Promocional',\n account_promoLabel: 'C\\u00F3digo:',\n account_promoValidating: 'Validando c\\u00F3digo promocional...',\n account_promoSuccess: '\\u00A1C\\u00F3digo canjeado! Acceso Pro hasta {{expires}}.',\n account_promoInvalid: 'C\\u00F3digo inv\\u00E1lido o expirado.',\n account_promoError: 'No se pudo validar el c\\u00F3digo. Comprueba tu conexi\\u00F3n.',\n account_promoEsc: 'esc: cancelar',\n account_promoHint: 'p: canjear c\\u00F3digo promocional',\n\n // ── Upgrade Prompt ──\n upgrade_proFeature: '{{title}} \\u2014 Funci\\u00F3n Pro',\n upgrade_profiles: 'Perfiles de Paquetes',\n upgrade_profilesDesc: 'Exporta e importa tu configuraci\\u00F3n de Homebrew entre m\\u00E1quinas. Guarda perfiles con nombre para trabajo, personal o proyectos espec\\u00EDficos.',\n upgrade_cleanup: 'Limpieza Inteligente',\n upgrade_cleanupDesc: 'Encuentra paquetes hu\\u00E9rfanos, analiza uso de disco por paquete y recupera espacio con limpieza inteligente de un clic.',\n upgrade_history: 'Historial de Acciones',\n upgrade_historyDesc: 'Rastrea cada instalaci\\u00F3n, desinstalaci\\u00F3n y actualizaci\\u00F3n con marcas de tiempo. Busca y filtra tu historial de gesti\\u00F3n de paquetes.',\n upgrade_security: 'Auditor\\u00EDa de Seguridad',\n upgrade_securityDesc: 'Escanea paquetes instalados contra vulnerabilidades conocidas (CVEs). Ve niveles de severidad, versiones afectadas y correcciones disponibles.',\n upgrade_pricing: '9,95\\u20AC/mes o 82\\u20AC/a\\u00F1o (ahorra 31%)',\n upgrade_teamFeature: '{{title}} \\u2014 Tier Team',\n upgrade_teamPricing: '8\\u20AC/seat/mes o 81,60\\u20AC/seat/a\\u00F1o (ahorra 15%) \\u2014 desde 3 seats',\n upgrade_buyAt: 'Compra en:',\n upgrade_buyUrl: 'https://buy.polar.sh/polar_cl_yQsiUeDelyyEQznbWffD1j77JAyP24ra7iEVQ22PA4h',\n upgrade_buyUrlTeam: 'https://buy.polar.sh/polar_cl_CO6xqSzKgFiQJwXnhZYGqisOP04Wspi0KKZSn38NjFZ?quantity=3',\n upgrade_activateWith: 'Luego activa con:',\n upgrade_activateCmd: 'brew-tui activate <tu-clave-de-licencia>',\n upgrade_proLabel: 'Brew-TUI Pro \\u2014 9,95\\u20AC/mes o 82\\u20AC/a\\u00F1o \\u2014 Incluye BrewBar para macOS',\n upgrade_teamLabel: 'Brew-TUI Team \\u2014 8\\u20AC/seat/mes \\u2014 Incluye todo Pro m\\u00E1s Compliance',\n\n // ── Progress Log ──\n progress_noOutput: 'Sin salida a\\u00FAn',\n\n // ── Search Input ──\n searchInput_placeholder: 'Escribe para filtrar...',\n\n // ── Profile Manager ──\n profileMgr_tapping: 'A\\u00F1adiendo tap {{name}}...',\n profileMgr_installing: 'Instalando {{name}}...',\n profileMgr_installingCask: 'Instalando cask {{name}}...',\n profileMgr_importDone: '\\u00A1Listo! {{count}} paquetes instalados.',\n\n // ── CLI ──\n cli_usageActivate: 'Uso: brew-tui activate <clave-de-licencia>',\n cli_activated: '\\u2714 Pro activado para {{email}}',\n cli_plan: ' Plan: {{plan}}',\n cli_expires: ' Expira: {{date}}',\n cli_activationFailed: '\\u2718 Activaci\\u00F3n fallida: {{error}}',\n cli_noLicense: 'No se encontr\\u00F3 licencia activa.',\n cli_deactivated: '\\u2714 Licencia desactivada.',\n cli_planFree: 'Plan: Gratis',\n cli_planPro: 'Plan: Pro',\n cli_planExpired: 'Plan: Expirada',\n cli_confirmDeactivate: '\\u00BFDesactivar tu licencia Pro en esta m\\u00E1quina? (s/N): ',\n cli_deactivateCancelled: 'Desactivaci\\u00F3n cancelada.',\n cli_upgradeHint: 'Ejecuta `brew-tui activate <clave>` para actualizar a Pro.',\n cli_revalidateHint: 'Ejecuta `brew-tui revalidate` para refrescar tu licencia actual.',\n cli_email: 'Email: {{email}}',\n cli_status: 'Estado: {{status}}',\n cli_revalidated: '\\u2714 Licencia revalidada.',\n cli_revalidateGrace: '\\u26A0 No se pudo contactar al servidor. Tu licencia actual sigue siendo usable dentro del periodo de gracia offline.',\n cli_revalidateFailed: '\\u2718 La revalidaci\\u00F3n de la licencia fall\\u00F3. Renueva tu suscripci\\u00F3n o activa una clave v\\u00E1lida.',\n cli_rateLimited: 'Demasiados intentos de activaci\\u00F3n. Int\\u00E9ntalo en {{minutes}} minutos.',\n cli_cooldown: 'Por favor espera antes de intentar de nuevo.',\n cli_brewbarInstalling: 'Descargando BrewBar...',\n cli_brewbarInstalled: '\\u2714 BrewBar instalado en /Applications/BrewBar.app',\n cli_brewbarAlreadyInstalled: 'BrewBar ya est\\u00E1 instalado. Usa --force para reinstalar.',\n cli_brewbarUninstalled: '\\u2714 BrewBar eliminado de /Applications.',\n cli_brewbarNotInstalled: 'BrewBar no est\\u00E1 instalado.',\n cli_brewbarProRequired: '\\u2718 BrewBar requiere una licencia Pro.\\n Ejecuta: brew-tui activate <clave>',\n cli_brewbarRevalidateRequired: '\\u2718 BrewBar requiere una licencia Pro v\\u00E1lida.\\n Ejecuta: brew-tui revalidate',\n cli_brewbarMacOnly: '\\u2718 BrewBar solo est\\u00E1 disponible en macOS.',\n cli_brewbarDownloadFailed: '\\u2718 Error al descargar BrewBar: {{error}}',\n cli_brewbarAutoFailed: '\\u26A0 No se pudo lanzar BrewBar automáticamente: {{error}}',\n cli_deactivateRemoteFailed: '\\u26A0 Advertencia: No se pudo contactar al servidor para desactivar remotamente. La licencia se elimin\\u00F3 localmente pero puede seguir contando como activa.',\n\n // ── License degradation (Layer 15) ──\n license_offlineWarning: 'Tu licencia no se ha validado en {{days}} d\\u00EDas. Por favor con\\u00E9ctate a internet.',\n\n // ── Plurals ──\n plural_vulns_one: '({{count}} vuln)',\n plural_vulns_other: '({{count}} vulns)',\n plural_warnings_one: '{{count}} advertencia',\n plural_warnings_other: '{{count}} advertencias',\n\n // ── Scroll indicators ──\n scroll_moreAbove: '\\u2191 {{count}} m\\u00E1s',\n scroll_moreBelow: '\\u2193 {{count}} m\\u00E1s',\n\n // ── SCR-001: Cleanup warning ──\n cleanup_warning_system_tools: 'Advertencia: los hu\\u00E9rfanos detectados pueden incluir dependencias de herramientas no gestionadas por Homebrew. Revisa la lista antes de continuar.',\n\n // ── SCR-002: Installed column headers ──\n installed_col_package: 'Paquete',\n installed_col_version: 'Versi\\u00F3n',\n installed_col_status: 'Estado',\n\n // ── SCR-003: Search failed ──\n search_failed: 'B\\u00FAsqueda fallida',\n\n // ── SCR-007: Deactivate failed ──\n deactivate_failed: 'Error al desactivar',\n\n // ── ACC-005: Version labels ──\n version_installed: 'instalado:',\n version_available: 'disponible:',\n\n // ── SCR-006: Upgrade-all replay warning ──\n upgrade_all_warning: 'Nota: esto actualizar\\u00E1 todos los paquetes desactualizados actualmente, que pueden diferir del conjunto original.',\n\n // ── SEG-007: Delete account ──\n delete_account_confirm: '\\u00BFEliminar todos los datos de Brew-TUI (~/.brew-tui)? Esto elimina tu licencia, perfiles e historial. Esta acci\\u00F3n no se puede deshacer.',\n delete_account_success: 'Todos los datos de Brew-TUI han sido eliminados.',\n\n // ── SCR-012: Upgrade All packages list ──\n outdated_upgradeAllList: 'Paquetes a actualizar: {{list}}',\n\n // ── SCR-005: Profile import summary ──\n profiles_importSummary: 'Este perfil contiene {{formulae}} formulae y {{casks}} casks. \\u00BFContinuar?',\n\n // ── SCR-017: Network error ──\n security_networkError: 'No se pudo conectar con la base de datos de vulnerabilidades OSV.dev. Verifica tu conexi\\u00F3n a internet.',\n\n // ── ARQ-004: Dashboard last updated ──\n dashboard_lastUpdated: '\\u00DAltima actualizaci\\u00F3n: {{time}}',\n\n // ── SCR-014: Services last error ──\n services_lastError: '\\u00DAltimo error: {{error}}',\n\n // ── SCR-010: Generic network error ──\n error_network: 'Error de red: no se puede conectar con el servidor.',\n\n // ── ARQ-005: Security cache ──\n security_rollback_hint: 'R: abrir Rollback para restaurar versiones',\n security_cachedResults: 'Mostrando resultados en cach\\u00E9 (hace {{time}}). Presiona r para re-escanear.',\n\n // ── Impact Analysis ──\n impact_brewfile_hint: '\\u{1F4A1} Añade al Brewfile para fijar esta versión antes de actualizar',\n impact_analyzing: 'Analizando impacto de actualizaci\\u00F3n...',\n impact_high: 'RIESGO ALTO',\n impact_medium: 'RIESGO MEDIO',\n impact_low: 'RIESGO BAJO',\n impact_affects: 'afecta {{count}} paquetes instalados',\n impact_usedBy: 'Usado por: {{packages}}',\n impact_hint: 'Selecciona un paquete para ver el impacto',\n impact_reason_critical_package: 'Paquete cr\\u00EDtico del sistema',\n impact_reason_major_bump: 'Cambio de versi\\u00F3n mayor',\n impact_reason_many_deps: '{{count}} paquetes dependen de este',\n\n // ── Rollback ──\n rollback_title: 'Rollback \\u2014 Restaurar Estado Anterior',\n rollback_no_snapshots: 'No hay snapshots disponibles. Los snapshots se capturan autom\\u00E1ticamente tras cada operaci\\u00F3n.',\n rollback_select_snapshot: 'Selecciona un snapshot para restaurar',\n rollback_snapshot_label: '{{label}} \\u2014 {{date}}',\n rollback_snapshot_auto: 'Auto',\n rollback_diff_empty: 'No se detectaron cambios entre este snapshot y el estado actual',\n rollback_confirm: '\\u00BFRevertir {{count}} paquete(s) a este estado?',\n rollback_strategy_bottle: 'desde cach\\u00E9 de bottle',\n rollback_strategy_versioned: 'desde formula versionada',\n rollback_strategy_pin: 'solo fijar (versi\\u00F3n no restaurable)',\n rollback_strategy_unavailable: 'no se puede restaurar',\n rollback_executing: 'Revirtiendo...',\n rollback_success: 'Rollback completado',\n rollback_error: 'Rollback fallido: {{error}}',\n rollback_item_downgrade: '{{name}}: {{from}} \\u2192 {{to}}',\n rollback_item_remove: 'Eliminar: {{name}}',\n rollback_item_install: 'Instalar: {{name}} {{version}}',\n rollback_warning_cask: 'Los Casks solo se fijar\\u00E1n (restauraci\\u00F3n de versi\\u00F3n no disponible)',\n rollback_capturing: 'Capturando snapshot actual...',\n\n // ── Sync ──\n sync_title: 'Sincronización entre máquinas',\n sync_disabled: 'Sync no está configurado. Pulsa s para configurar iCloud sync.',\n sync_status_ok: 'Sincronizado',\n sync_status_drift: '{{count}} cambio(s) desde otras máquinas',\n sync_status_conflict: '{{count}} conflicto(s) requieren resolución',\n sync_last_sync: 'Última sync: {{date}}',\n sync_machine: 'Esta máquina: {{name}}',\n sync_other_machines: 'Otras máquinas: {{names}}',\n sync_syncing: 'Sincronizando...',\n sync_success: 'Sincronización completa',\n sync_error: 'Sync fallida: {{error}}',\n sync_conflict_title: 'Conflicto: {{package}}',\n sync_conflict_local: 'Esta máquina: {{version}}',\n sync_conflict_remote: '{{machine}}: {{version}}',\n sync_conflict_use_local: 'Mantener local',\n sync_conflict_use_remote: 'Usar remoto',\n sync_setup_icloud: 'Configurando iCloud sync...',\n sync_no_icloud: 'iCloud Drive no encontrado. Asegúrate de que iCloud Drive está activado en Ajustes del Sistema.',\n\n // ── Upgrade Prompt — Sync ──\n upgrade_sync: 'Sincronización entre máquinas',\n upgrade_syncDesc: 'Mantén tu configuración de Homebrew sincronizada entre varios Macs mediante iCloud Drive. Fusiona instalaciones automáticamente y resuelve conflictos.',\n\n // ── Brewfile ──\n brewfile_title: 'Brewfile Declarativo',\n brewfile_compliant: 'en conformidad',\n brewfile_no_brewfile: 'No se encontró Brewfile. Pulsa n para crear uno desde tu instalación actual.',\n brewfile_create_name: 'Nombre del Brewfile (Enter para confirmar):',\n brewfile_created: 'Brewfile creado: {{name}}',\n brewfile_drift_missing: '{{count}} paquetes faltantes',\n brewfile_drift_extra: '{{count}} paquetes extra',\n brewfile_drift_wrong: '{{count}} versiones incorrectas',\n brewfile_reconciling: 'Reconciliando...',\n brewfile_reconcile_success: 'Reconciliación completa',\n brewfile_reconcile_error: 'Reconciliación fallida: {{error}}',\n brewfile_exported: 'Exportado a {{path}}',\n brewfile_formulae_count: '{{count}} formulae',\n brewfile_casks_count: '{{count}} casks',\n brewfile_strict_mode: 'Modo estricto',\n brewfile_in_sync: '✓ El sistema coincide con el Brewfile',\n brewfile_computing_drift: 'Calculando deriva...',\n\n // ── Compliance ──\n view_compliance: 'Compliance',\n compliance_title: 'Conformidad de Equipo',\n compliance_no_policy: 'No hay política cargada. Pulsa i para importar un archivo de política.',\n compliance_score: '{{score}}% en conformidad',\n compliance_violations: '{{count}} violación(es)',\n compliance_ok: 'Totalmente en conformidad',\n compliance_import_prompt: 'Ruta del archivo de política (Enter para confirmar):',\n compliance_import_error: 'Error al cargar la política: {{error}}',\n compliance_violation_missing: 'Faltante: {{name}} (requerido)',\n compliance_violation_forbidden: 'Prohibido: {{name}} — {{reason}}',\n compliance_violation_version: 'Versión incorrecta: {{name}} (requerida {{required}}, instalada {{installed}})',\n compliance_violation_extra: 'Paquete extra: {{name}}',\n compliance_remediating: 'Remediando...',\n compliance_remediate_success: 'Remediación completa',\n compliance_remediate_error: 'Remediación fallida: {{error}}',\n compliance_export_done: 'Informe exportado a {{path}}',\n compliance_press_r_hint: 'Pulsa r para ejecutar la comprobación de cumplimiento.',\n compliance_machine: 'Máquina: {{name}}',\n compliance_policy_name: 'Política: {{name}}',\n compliance_policy_by: 'Mantenida por: {{maintainer}}',\n\n // ── Upgrade Prompt — Compliance ──\n upgrade_compliance: 'Conformidad de Equipo',\n upgrade_complianceDesc: 'Aplica políticas de paquetes en todo tu equipo. Define paquetes requeridos, prohibidos y con versión fijada, y remedia desviaciones automáticamente.',\n\n // ── Upgrade Prompt — Rollback / Brewfile ──\n upgrade_rollback: 'Rollback Inteligente',\n upgrade_rollbackDesc: 'Restaura tu estado de Homebrew desde cualquier snapshot pasado. Brew-TUI captura un snapshot antes de cada install/upgrade para que revertir una actualización fallida sea una pulsación.',\n upgrade_brewfile: 'Brewfile Declarativo',\n upgrade_brewfileDesc: 'Fija tu toolchain en un Brewfile versionado y reconcilia cualquier máquina contra él. Score de deriva, detección de faltantes/sobrantes y alineación con una pulsación.',\n};\n\nexport default es;\n","import { logger } from '../utils/logger.js';\n\nexport function fetchWithTimeout(url: string, options: RequestInit = {}, timeoutMs = 15_000): Promise<Response> {\n return fetch(url, { ...options, signal: AbortSignal.timeout(timeoutMs) });\n}\n\n/**\n * Wrap an async function with debug-level latency logging.\n */\nexport function timed<T>(label: string, fn: () => Promise<T>): Promise<T> {\n const start = Date.now();\n return fn().finally(() => logger.debug(`${label} took ${Date.now() - start}ms`));\n}\n\ninterface RetryOptions {\n attempts?: number;\n baseDelayMs?: number;\n maxDelayMs?: number;\n retryOn?: (response: Response) => boolean;\n}\n\nconst DEFAULT_RETRY: Required<Omit<RetryOptions, 'retryOn'>> & Pick<RetryOptions, 'retryOn'> = {\n attempts: 3,\n baseDelayMs: 500,\n maxDelayMs: 4_000,\n retryOn: (res) => res.status >= 500 && res.status < 600,\n};\n\nfunction isTransientNetworkError(err: unknown): boolean {\n const msg = err instanceof Error ? err.message : String(err);\n return /fetch failed|ECONNREFUSED|ENOTFOUND|ETIMEDOUT|network|timeout|abort|EAI_AGAIN/i.test(msg);\n}\n\n/**\n * fetchWithTimeout + retry with exponential backoff. Retries only on transient\n * network errors and on responses matching `retryOn` (default: 5xx). 4xx\n * responses are returned to the caller without retry.\n */\nexport async function fetchWithRetry(\n url: string,\n options: RequestInit = {},\n timeoutMs = 15_000,\n retry: RetryOptions = {},\n): Promise<Response> {\n const cfg = { ...DEFAULT_RETRY, ...retry };\n let lastError: unknown;\n\n for (let attempt = 1; attempt <= cfg.attempts; attempt++) {\n try {\n const res = await fetchWithTimeout(url, options, timeoutMs);\n if (attempt < cfg.attempts && cfg.retryOn?.(res)) {\n const delay = Math.min(cfg.baseDelayMs * Math.pow(2, attempt - 1), cfg.maxDelayMs);\n logger.warn(`fetchWithRetry: ${url} returned ${res.status}, retry ${attempt}/${cfg.attempts - 1} in ${delay}ms`);\n await new Promise((r) => setTimeout(r, delay));\n continue;\n }\n return res;\n } catch (err) {\n lastError = err;\n if (attempt >= cfg.attempts || !isTransientNetworkError(err)) throw err;\n const delay = Math.min(cfg.baseDelayMs * Math.pow(2, attempt - 1), cfg.maxDelayMs);\n logger.warn(`fetchWithRetry: ${url} threw transient error, retry ${attempt}/${cfg.attempts - 1} in ${delay}ms`, { error: String(err) });\n await new Promise((r) => setTimeout(r, delay));\n }\n }\n\n throw lastError instanceof Error ? lastError : new Error(String(lastError));\n}\n"],"mappings":";;;;;AAAA,SAAS,cAAc;;;ACAvB,IAAM,KAAK;AAAA;AAAA,EAET,WAAW;AAAA,EACX,WAAW;AAAA,EACX,aAAa;AAAA;AAAA,EAGb,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,aAAa;AAAA,EACb,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB,cAAc;AAAA,EACd,eAAe;AAAA,EACf,eAAe;AAAA,EACf,WAAW;AAAA,EACX,oBAAoB;AAAA,EACpB,cAAc;AAAA;AAAA,EAGd,eAAe;AAAA,EACf,WAAW;AAAA,EACX,WAAW;AAAA,EACX,aAAa;AAAA,EACb,WAAW;AAAA,EACX,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB,cAAc;AAAA,EACd,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,cAAc;AAAA,EACd,cAAc;AAAA,EACd,UAAU;AAAA,EACV,cAAc;AAAA,EACd,aAAa;AAAA,EACb,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,aAAa;AAAA,EACb,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,iBAAiB;AAAA,EACjB,YAAY;AA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C,OAAO,KAAK,MAAM,EAAE,OAAO,OAAO,GAAG,EAAE,CAAC;AACtI,YAAM,IAAI,QAAQ,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC;AAAA,IAC/C;AAAA,EACF;AAEA,QAAM,qBAAqB,QAAQ,YAAY,IAAI,MAAM,OAAO,SAAS,CAAC;AAC5E;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/data-dir.ts"],"sourcesContent":["import { homedir } from 'node:os';\nimport { join } from 'node:path';\nimport { mkdir, readFile, writeFile } from 'node:fs/promises';\nimport { randomUUID } from 'node:crypto';\n\nexport const DATA_DIR = join(homedir(), '.brew-tui');\nexport const PROFILES_DIR = join(DATA_DIR, 'profiles');\nexport const LICENSE_PATH = join(DATA_DIR, 'license.json');\nexport const HISTORY_PATH = join(DATA_DIR, 'history.json');\nexport const SNAPSHOTS_DIR = join(DATA_DIR, 'snapshots');\nexport const CVE_CACHE_PATH = join(DATA_DIR, 'cve-cache.json');\nexport const MACHINE_ID_PATH = join(DATA_DIR, 'machine-id');\n\nexport async function ensureDataDirs(): Promise<void> {\n await mkdir(DATA_DIR, { recursive: true, mode: 0o700 });\n await mkdir(PROFILES_DIR, { recursive: true, mode: 0o700 });\n await mkdir(SNAPSHOTS_DIR, { recursive: true, mode: 0o700 });\n}\n\n// In-memory cache + serializer to prevent multiple concurrent first-time\n// creations from racing and producing different UUIDs on first launch.\nlet cachedMachineId: string | null = null;\nlet pendingResolution: Promise<string> | null = null;\n\nexport async function getMachineId(): Promise<string> {\n if (cachedMachineId) return cachedMachineId;\n if (pendingResolution) return pendingResolution;\n\n pendingResolution = (async () => {\n try {\n const id = (await readFile(MACHINE_ID_PATH, 'utf-8')).trim();\n if (id) {\n cachedMachineId = id;\n return id;\n }\n } catch { /* file does not exist yet */ }\n\n const id = randomUUID();\n await mkdir(DATA_DIR, { recursive: true, mode: 0o700 });\n await writeFile(MACHINE_ID_PATH, id, { encoding: 'utf-8', mode: 0o600 });\n cachedMachineId = id;\n return id;\n })();\n\n try {\n return await pendingResolution;\n } finally {\n pendingResolution = null;\n }\n}\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB,SAAS,OAAO,UAAU,iBAAiB;AAC3C,SAAS,kBAAkB;AAEpB,IAAM,WAAW,KAAK,QAAQ,GAAG,WAAW;AAC5C,IAAM,eAAe,KAAK,UAAU,UAAU;AAC9C,IAAM,eAAe,KAAK,UAAU,cAAc;AAClD,IAAM,eAAe,KAAK,UAAU,cAAc;AAClD,IAAM,gBAAgB,KAAK,UAAU,WAAW;AAChD,IAAM,iBAAiB,KAAK,UAAU,gBAAgB;AACtD,IAAM,kBAAkB,KAAK,UAAU,YAAY;AAE1D,eAAsB,iBAAgC;AACpD,QAAM,MAAM,UAAU,EAAE,WAAW,MAAM,MAAM,IAAM,CAAC;AACtD,QAAM,MAAM,cAAc,EAAE,WAAW,MAAM,MAAM,IAAM,CAAC;AAC1D,QAAM,MAAM,eAAe,EAAE,WAAW,MAAM,MAAM,IAAM,CAAC;AAC7D;AAIA,IAAI,kBAAiC;AACrC,IAAI,oBAA4C;AAEhD,eAAsB,eAAgC;AACpD,MAAI,gBAAiB,QAAO;AAC5B,MAAI,kBAAmB,QAAO;AAE9B,uBAAqB,YAAY;AAC/B,QAAI;AACF,YAAMA,OAAM,MAAM,SAAS,iBAAiB,OAAO,GAAG,KAAK;AAC3D,UAAIA,KAAI;AACN,0BAAkBA;AAClB,eAAOA;AAAA,MACT;AAAA,IACF,QAAQ;AAAA,IAAgC;AAExC,UAAM,KAAK,WAAW;AACtB,UAAM,MAAM,UAAU,EAAE,WAAW,MAAM,MAAM,IAAM,CAAC;AACtD,UAAM,UAAU,iBAAiB,IAAI,EAAE,UAAU,SAAS,MAAM,IAAM,CAAC;AACvE,sBAAkB;AAClB,WAAO;AAAA,EACT,GAAG;AAEH,MAAI;AACF,WAAO,MAAM;AAAA,EACf,UAAE;AACA,wBAAoB;AAAA,EACtB;AACF;","names":["id"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/sync/sync-engine.ts","../src/lib/sync/crypto.ts","../src/lib/sync/backends/icloud-backend.ts","../src/lib/license/license-manager.ts","../src/lib/license/polar-api.ts"],"sourcesContent":["import { readFile, writeFile, rename } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { hostname } from 'node:os';\nimport { encryptPayload, decryptPayload } from './crypto.js';\nimport {\n readSyncEnvelope,\n writeSyncEnvelope,\n isICloudAvailable,\n} from './backends/icloud-backend.js';\nimport { captureSnapshot } from '../state-snapshot/snapshot.js';\nimport { DATA_DIR, getMachineId } from '../data-dir.js';\nimport { loadLicense } from '../license/license-manager.js';\nimport { logger } from '../../utils/logger.js';\nimport type {\n SyncConfig,\n SyncPayload,\n SyncConflict,\n SyncResult,\n MachineState,\n SyncEnvelope,\n} from './types.js';\nimport type { BrewfileSchema } from '../brewfile/types.js';\n\nconst SYNC_CONFIG_PATH = join(DATA_DIR, 'sync-config.json');\n\n// ── Config I/O ──────────────────────────────────────────────────────────────\n\nexport async function loadSyncConfig(): Promise<SyncConfig | null> {\n try {\n const raw = await readFile(SYNC_CONFIG_PATH, 'utf-8');\n return JSON.parse(raw) as SyncConfig;\n } catch {\n return null;\n }\n}\n\nexport async function saveSyncConfig(config: SyncConfig): Promise<void> {\n const tmpPath = SYNC_CONFIG_PATH + '.tmp';\n await writeFile(tmpPath, JSON.stringify(config, null, 2), {\n encoding: 'utf-8',\n mode: 0o600,\n });\n await rename(tmpPath, SYNC_CONFIG_PATH);\n}\n\n// ── Machine ID ───────────────────────────────────────────────────────────────\n// Single canonical implementation lives in data-dir.ts. The previous fallback\n// to os.hostname() here meant two different machines with the same hostname\n// (common on freshly-imaged corporate fleets) collided in sync state.\n\nexport { getMachineId };\n\n// ── Conflict detection ───────────────────────────────────────────────────────\n\nfunction detectConflicts(\n localSnapshot: { formulae: Array<{ name: string; version: string }>; casks: Array<{ name: string; version: string }> },\n otherMachines: MachineState[],\n localMachineId: string,\n): SyncConflict[] {\n const conflicts: SyncConflict[] = [];\n\n const localFormulaMap = new Map(localSnapshot.formulae.map((f) => [f.name, f.version]));\n const localCaskMap = new Map(localSnapshot.casks.map((c) => [c.name, c.version]));\n\n for (const machine of otherMachines) {\n if (machine.machineId === localMachineId) continue;\n\n // Check formula conflicts: same package, different version on both machines\n for (const remoteFormula of machine.snapshot.formulae) {\n const localVersion = localFormulaMap.get(remoteFormula.name);\n if (localVersion !== undefined && localVersion !== remoteFormula.version) {\n conflicts.push({\n packageName: remoteFormula.name,\n packageType: 'formula',\n localVersion,\n remoteMachine: machine.machineName,\n remoteVersion: remoteFormula.version,\n });\n }\n }\n\n // Check cask conflicts\n for (const remoteCask of machine.snapshot.casks) {\n const localVersion = localCaskMap.get(remoteCask.name);\n if (localVersion !== undefined && localVersion !== remoteCask.version) {\n conflicts.push({\n packageName: remoteCask.name,\n packageType: 'cask',\n localVersion,\n remoteMachine: machine.machineName,\n remoteVersion: remoteCask.version,\n });\n }\n }\n }\n\n return conflicts;\n}\n\n// ── Merge ────────────────────────────────────────────────────────────────────\n\nasync function writeEnvelope(payload: SyncPayload, licenseKey: string): Promise<string> {\n const now = new Date().toISOString();\n const { encrypted, iv, tag } = encryptPayload(payload, licenseKey);\n const envelope: SyncEnvelope = {\n schemaVersion: 1,\n encrypted,\n iv,\n tag,\n updatedAt: now,\n };\n await writeSyncEnvelope(envelope);\n return now;\n}\n\nasync function loadLicenseKeyOrThrow(): Promise<string> {\n // Sync requires Pro, and Pro requires a license. Read it lazily so\n // sync-store callers don't have to plumb the key through every call.\n const license = await loadLicense();\n if (!license || !license.key) {\n throw new Error('Sync requires an active license');\n }\n return license.key;\n}\n\nfunction mergePayload(existing: SyncPayload, localState: MachineState): SyncPayload {\n return {\n machines: {\n ...existing.machines,\n [localState.machineId]: localState,\n },\n };\n}\n\n// ── Main sync function ───────────────────────────────────────────────────────\n\nexport async function sync(\n isPro: boolean,\n currentBrewfile?: BrewfileSchema,\n): Promise<SyncResult> {\n if (!isPro) {\n throw new Error('Pro license required');\n }\n\n const available = await isICloudAvailable();\n if (!available) {\n return {\n success: false,\n conflicts: [],\n resolvedCount: 0,\n error: 'iCloud Drive not available',\n };\n }\n\n const licenseKey = await loadLicenseKeyOrThrow();\n\n let existingPayload: SyncPayload | null = null;\n\n try {\n const envelope = await readSyncEnvelope();\n if (envelope) {\n existingPayload = decryptPayload(envelope.encrypted, envelope.iv, envelope.tag, licenseKey);\n }\n } catch (err) {\n logger.warn('sync: could not decrypt existing payload, starting fresh', { error: String(err) });\n existingPayload = null;\n }\n\n // Capture current local state\n const snapshot = await captureSnapshot();\n const machineId = await getMachineId();\n const machineName = hostname();\n\n const localState: MachineState = {\n machineId,\n machineName,\n updatedAt: new Date().toISOString(),\n snapshot,\n ...(currentBrewfile ? { brewfile: currentBrewfile } : {}),\n };\n\n // Detect conflicts against other machines in the payload\n const otherMachines = existingPayload\n ? Object.values(existingPayload.machines).filter((m) => m.machineId !== machineId)\n : [];\n\n const conflicts = detectConflicts(snapshot, otherMachines, machineId);\n\n // Always write the local machine state to the payload, even when conflicts\n // exist, so that applyConflictResolutions() has a local entry to update.\n // Without this, the iCloud envelope keeps only remote machines, and\n // resolution updates are silently dropped (they require localMachine to exist).\n const basePayload: SyncPayload = existingPayload ?? { machines: {} };\n const mergedPayload = mergePayload(basePayload, localState);\n\n if (conflicts.length > 0) {\n // Persist local state, then surface conflicts so the user can resolve them.\n await writeEnvelope(mergedPayload, licenseKey);\n return {\n success: false,\n conflicts,\n resolvedCount: 0,\n };\n }\n\n const now = await writeEnvelope(mergedPayload, licenseKey);\n\n // Update local sync config\n const existingConfig = await loadSyncConfig();\n await saveSyncConfig({\n enabled: true,\n machineId,\n machineName,\n ...(existingConfig ?? {}),\n lastSync: now,\n });\n\n logger.info('sync: completed successfully', { machineId, machines: Object.keys(mergedPayload.machines).length });\n\n return {\n success: true,\n conflicts: [],\n resolvedCount: 0,\n };\n}\n\n// ── Conflict resolution ──────────────────────────────────────────────────────\n\nexport async function applyConflictResolutions(\n payload: SyncPayload,\n resolutions: Array<{ conflict: SyncConflict; resolution: 'use-local' | 'use-remote' }>,\n localMachineId: string,\n): Promise<void> {\n // Work on a mutable copy\n const updatedPayload: SyncPayload = {\n machines: { ...payload.machines },\n };\n\n for (const { conflict, resolution } of resolutions) {\n if (resolution !== 'use-remote') continue;\n // Re-read latest local machine on every iteration so consecutive resolutions\n // build on top of each other instead of overwriting prior changes.\n const localMachine = updatedPayload.machines[localMachineId];\n if (!localMachine) {\n logger.warn('sync: cannot apply resolution, local machine missing in payload', { localMachineId });\n continue;\n }\n if (conflict.packageType === 'formula') {\n updatedPayload.machines[localMachineId] = {\n ...localMachine,\n snapshot: {\n ...localMachine.snapshot,\n formulae: localMachine.snapshot.formulae.map((f) =>\n f.name === conflict.packageName\n ? { ...f, version: conflict.remoteVersion }\n : f,\n ),\n },\n };\n } else {\n updatedPayload.machines[localMachineId] = {\n ...localMachine,\n snapshot: {\n ...localMachine.snapshot,\n casks: localMachine.snapshot.casks.map((c) =>\n c.name === conflict.packageName\n ? { ...c, version: conflict.remoteVersion }\n : c,\n ),\n },\n };\n }\n }\n\n const licenseKey = await loadLicenseKeyOrThrow();\n await writeEnvelope(updatedPayload, licenseKey);\n logger.info('sync: conflict resolutions applied', { count: resolutions.length });\n}\n","import { createCipheriv, createDecipheriv, randomBytes, scryptSync, hkdfSync } from 'node:crypto';\nimport type { SyncPayload } from './types.js';\n\n// SEG-003: Cross-machine sync encryption.\n// The two constants below are public (compiled into the npm bundle). The\n// per-user secret factor is the Polar license key, which only the user's\n// own machines hold and which Polar issues — so any two of the user's\n// machines derive the same key, but bundle + iCloud snoop is no longer\n// enough to decrypt: the attacker also needs the license key.\n//\n// HKDF-SHA256 over scrypt: the license key is high-entropy by construction\n// (Polar issues UUID-style keys), so the cost-hardening of scrypt isn't\n// what's protecting the key — the secrecy of the license key is. HKDF is\n// also faster, so machines don't pay scrypt's CPU tax on every sync.\nconst ENCRYPTION_SECRET = 'brew-tui-sync-aes256gcm-v1';\nconst HKDF_SALT = 'brew-tui-sync-salt-v1';\n\nconst keyCache = new Map<string, Buffer>();\nlet _legacyKey: Buffer | null = null;\n\nfunction deriveEncryptionKey(licenseKey: string): Buffer {\n const cached = keyCache.get(licenseKey);\n if (cached) return cached;\n const derived = Buffer.from(hkdfSync('sha256', ENCRYPTION_SECRET, HKDF_SALT, licenseKey, 32));\n keyCache.set(licenseKey, derived);\n return derived;\n}\n\n// Legacy key — scrypt(SECRET, SALT), no license-key factor. Used as a\n// decryption fallback for envelopes written by 0.6.2 and earlier.\nfunction deriveLegacyKey(): Buffer {\n if (!_legacyKey) {\n _legacyKey = scryptSync(ENCRYPTION_SECRET, HKDF_SALT, 32, { N: 16384, r: 8, p: 1 });\n }\n return _legacyKey;\n}\n\nexport function encryptPayload(data: SyncPayload, licenseKey: string): { encrypted: string; iv: string; tag: string } {\n const key = deriveEncryptionKey(licenseKey);\n const iv = randomBytes(12); // 96-bit IV for GCM\n const cipher = createCipheriv('aes-256-gcm', key, iv);\n\n const plaintext = JSON.stringify(data);\n const ciphertext = Buffer.concat([cipher.update(plaintext, 'utf-8'), cipher.final()]);\n const tag = cipher.getAuthTag();\n\n return {\n encrypted: ciphertext.toString('base64'),\n iv: iv.toString('base64'),\n tag: tag.toString('base64'),\n };\n}\n\nexport function decryptPayload(encrypted: string, iv: string, tag: string, licenseKey: string): SyncPayload {\n const ivBuf = Buffer.from(iv, 'base64');\n const tagBuf = Buffer.from(tag, 'base64');\n const ciphertext = Buffer.from(encrypted, 'base64');\n\n // Try the licenseKey-bound key first; fall back to the legacy bundle-only\n // key for envelopes written by 0.6.2 and earlier. Re-encryption happens\n // automatically on the next sync write because writeEnvelope always uses\n // the current key.\n for (const key of [deriveEncryptionKey(licenseKey), deriveLegacyKey()]) {\n try {\n const decipher = createDecipheriv('aes-256-gcm', key, ivBuf);\n decipher.setAuthTag(tagBuf);\n const plaintext = Buffer.concat([decipher.update(ciphertext), decipher.final()]);\n return JSON.parse(plaintext.toString('utf-8')) as SyncPayload;\n } catch { /* try next */ }\n }\n throw new Error('Failed to decrypt sync payload');\n}\n","import { readFile, writeFile, rename, mkdir, stat } from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport { join } from 'node:path';\nimport { logger } from '../../../utils/logger.js';\nimport type { SyncEnvelope } from '../types.js';\n\nconst ICLOUD_BASE = join(\n homedir(),\n 'Library', 'Mobile Documents', 'com~apple~CloudDocs',\n);\nexport const ICLOUD_SYNC_DIR = join(ICLOUD_BASE, 'BrewTUI');\nexport const ICLOUD_SYNC_PATH = join(ICLOUD_SYNC_DIR, 'sync.json');\n\nexport async function isICloudAvailable(): Promise<boolean> {\n try {\n await stat(ICLOUD_BASE);\n return true;\n } catch {\n return false;\n }\n}\n\nfunction isValidEnvelope(v: unknown): v is SyncEnvelope {\n if (!v || typeof v !== 'object') return false;\n const obj = v as Record<string, unknown>;\n return (\n obj['schemaVersion'] === 1 &&\n typeof obj['encrypted'] === 'string' &&\n typeof obj['iv'] === 'string' &&\n typeof obj['tag'] === 'string' &&\n typeof obj['updatedAt'] === 'string'\n );\n}\n\nexport async function readSyncEnvelope(): Promise<SyncEnvelope | null> {\n try {\n const raw = await readFile(ICLOUD_SYNC_PATH, 'utf-8');\n const parsed: unknown = JSON.parse(raw);\n if (!isValidEnvelope(parsed)) {\n logger.warn('sync: invalid envelope structure in iCloud file');\n return null;\n }\n return parsed;\n } catch (err: unknown) {\n // File does not exist yet — expected on first sync\n if (\n err instanceof Error &&\n (err as NodeJS.ErrnoException).code === 'ENOENT'\n ) {\n return null;\n }\n logger.warn('sync: could not read iCloud envelope', { error: String(err) });\n return null;\n }\n}\n\nexport async function writeSyncEnvelope(envelope: SyncEnvelope): Promise<void> {\n await mkdir(ICLOUD_SYNC_DIR, { recursive: true });\n const tmpPath = ICLOUD_SYNC_PATH + '.tmp';\n await writeFile(tmpPath, JSON.stringify(envelope, null, 2), {\n encoding: 'utf-8',\n mode: 0o600,\n });\n await rename(tmpPath, ICLOUD_SYNC_PATH);\n}\n","import { readFile, writeFile, rename, rm } from 'node:fs/promises';\nimport { createCipheriv, createDecipheriv, randomBytes, scryptSync, hkdfSync } from 'node:crypto';\nimport { LICENSE_PATH, ensureDataDirs, getMachineId } from '../data-dir.js';\nimport { activateLicense as apiActivate, validateLicense as apiValidate, deactivateLicense as apiDeactivate } from './polar-api.js';\nimport { t } from '../../i18n/index.js';\nimport type { LicenseData, LicenseFile } from './types.js';\n\n// SEG-009: Built-in perennial accounts removed from the bundle.\n// Previously a hardcoded map of customer emails bypassed Polar validation entirely;\n// any user could craft a license.json with one of those emails (the AES key is\n// derivable from the bundle) and gain perennial Pro/Team. Operator accounts now\n// authenticate via real Polar license keys like everyone else. This function is\n// retained as a stable export but always returns null; remove it once no caller\n// references it.\nexport function getBuiltinAccountType(_email: string): 'pro' | 'team' | 'free' | null {\n return null;\n}\n\nconst REVALIDATION_INTERVAL_MS = 24 * 60 * 60 * 1000; // 24h\nconst GRACE_PERIOD_MS = 7 * 24 * 60 * 60 * 1000; // 7 days\n\n// ── Layer 18: Client-side rate limiting on activations ──\nconst ACTIVATION_COOLDOWN_MS = 30_000; // 30 seconds between attempts\nconst MAX_ATTEMPTS = 5;\nconst LOCKOUT_MS = 15 * 60 * 1000; // 15 min lockout after max attempts\n\ninterface ActivationTracker {\n attempts: number;\n lastAttempt: number;\n lockedUntil: number;\n}\n\n// Note: rate limit state is in-memory only; resets on process restart\nconst tracker: ActivationTracker = {\n attempts: 0,\n lastAttempt: 0,\n lockedUntil: 0,\n};\n\nfunction checkRateLimit(): void {\n const now = Date.now();\n\n // Check lockout\n if (now < tracker.lockedUntil) {\n const remaining = Math.ceil((tracker.lockedUntil - now) / 60000);\n throw new Error(t('cli_rateLimited', { minutes: remaining }));\n }\n\n // Check cooldown\n if (now - tracker.lastAttempt < ACTIVATION_COOLDOWN_MS) {\n throw new Error(t('cli_cooldown'));\n }\n}\n\nfunction recordAttempt(success: boolean): void {\n const now = Date.now();\n tracker.lastAttempt = now;\n\n if (success) {\n tracker.attempts = 0;\n return;\n }\n\n tracker.attempts++;\n if (tracker.attempts >= MAX_ATTEMPTS) {\n tracker.lockedUntil = now + LOCKOUT_MS;\n tracker.attempts = 0;\n }\n}\n\n// SECURITY (SEG-002): the bundle-only constants below USED to be the entire\n// derivation input — anyone with the npm bundle could decrypt any user's\n// license.json. Now the per-user machineId is mixed into the HKDF info, so\n// the bundle alone is no longer sufficient: an attacker also needs the\n// target's ~/.brew-tui/machine-id. The two constants stay published; what's\n// secret is the user's local machineId, which never leaves the machine.\n//\n// HKDF-SHA256 was chosen over scrypt because Swift's CryptoKit (used by\n// BrewBar to read the same license.json) ships HKDF natively but not scrypt.\n// machineId is a UUIDv4 with 122 bits of entropy, so the cost-hardening of\n// scrypt is not what's protecting the key — the secrecy of the machineId is.\nconst ENCRYPTION_SECRET = 'brew-tui-license-aes256gcm-v1';\nconst HKDF_SALT = 'brew-tui-salt-v1';\n\nlet _derivedKey: Buffer | null = null;\nlet _legacyKey: Buffer | null = null;\nlet _decryptedWithLegacyKey = false;\n\nasync function deriveEncryptionKey(): Promise<Buffer> {\n if (_derivedKey) return _derivedKey;\n const machineId = await getMachineId();\n // HKDF: ikm = SECRET, salt = HKDF_SALT, info = machineId, len = 32\n const derived = hkdfSync('sha256', ENCRYPTION_SECRET, HKDF_SALT, machineId, 32);\n _derivedKey = Buffer.from(derived);\n return _derivedKey;\n}\n\n// Legacy key — scrypt(SECRET, SALT) with no machineId. Pre-existing\n// license.json files written by 0.6.2 and earlier are ciphered with this.\n// decryptLicenseData falls back to it; the next saveLicense re-ciphers\n// using the HKDF key. Drop once the fallback stops being hit in the wild.\nfunction deriveLegacyKey(): Buffer {\n if (!_legacyKey) _legacyKey = scryptSync(ENCRYPTION_SECRET, HKDF_SALT, 32);\n return _legacyKey;\n}\n\nasync function encryptLicenseData(data: LicenseData): Promise<{ encrypted: string; iv: string; tag: string }> {\n const key = await deriveEncryptionKey();\n const iv = randomBytes(12); // 96-bit IV for GCM\n const cipher = createCipheriv('aes-256-gcm', key, iv);\n\n const plaintext = JSON.stringify(data);\n const ciphertext = Buffer.concat([cipher.update(plaintext, 'utf-8'), cipher.final()]);\n const tag = cipher.getAuthTag();\n\n return {\n encrypted: ciphertext.toString('base64'),\n iv: iv.toString('base64'),\n tag: tag.toString('base64'),\n };\n}\n\nasync function decryptLicenseData(encrypted: string, iv: string, tag: string): Promise<LicenseData> {\n const ivBuf = Buffer.from(iv, 'base64');\n const tagBuf = Buffer.from(tag, 'base64');\n const ciphertext = Buffer.from(encrypted, 'base64');\n\n // Try the current (machine-bound) key first; fall back to the legacy\n // (bundle-only) key for upgrade compatibility.\n const candidates: Array<[Buffer, boolean]> = [\n [await deriveEncryptionKey(), false],\n [deriveLegacyKey(), true],\n ];\n let lastErr: unknown;\n for (const [key, isLegacy] of candidates) {\n try {\n const decipher = createDecipheriv('aes-256-gcm', key, ivBuf);\n decipher.setAuthTag(tagBuf);\n const plaintext = Buffer.concat([decipher.update(ciphertext), decipher.final()]);\n _decryptedWithLegacyKey = isLegacy;\n return JSON.parse(plaintext.toString('utf-8')) as LicenseData;\n } catch (err) { lastErr = err; }\n }\n throw lastErr instanceof Error ? lastErr : new Error('Failed to decrypt license');\n}\n\n// BK-003: Type guard for license data format\nfunction isLicenseFile(obj: unknown): obj is LicenseFile {\n return typeof obj === 'object' && obj !== null && (obj as Record<string, unknown>).version === 1;\n}\n\nfunction isEncryptedLicenseFile(obj: unknown): obj is LicenseFile & { encrypted: string; iv: string; tag: string } {\n if (!isLicenseFile(obj)) return false;\n const record = obj as unknown as Record<string, unknown>;\n return typeof record.encrypted === 'string'\n && typeof record.iv === 'string'\n && typeof record.tag === 'string';\n}\n\nexport async function loadLicense(): Promise<LicenseData | null> {\n try {\n const raw = await readFile(LICENSE_PATH, 'utf-8');\n const parsed: unknown = JSON.parse(raw);\n\n // BK-003: Validate parsed data\n if (!isLicenseFile(parsed)) {\n throw new Error('Invalid license data format');\n }\n\n const file = parsed as LicenseFile;\n\n if (file.version !== 1) {\n // Future: add migration logic here\n throw new Error('Unsupported data version');\n }\n\n // New encrypted format\n if (isEncryptedLicenseFile(file)) {\n const data = await decryptLicenseData(file.encrypted!, file.iv!, file.tag!);\n\n // SEG-002: Check machine ID if stored in the envelope.\n // getMachineId() now always resolves a value — if the user's machine-id\n // file was wiped, a new UUID is created and this check rejects the\n // license, prompting reactivation. Same behaviour the polar-api flow\n // already had on save.\n const fileRecord = file as unknown as Record<string, unknown>;\n if (fileRecord.machineId) {\n const currentMachineId = await getMachineId();\n if (fileRecord.machineId !== currentMachineId) {\n throw new Error('License was activated on a different machine');\n }\n }\n\n // If we fell back to the legacy bundle-only key, re-cipher with the\n // current machine-bound key so future reads use the strong path.\n if (_decryptedWithLegacyKey) {\n _decryptedWithLegacyKey = false;\n try { await saveLicense(data); } catch { /* best effort */ }\n }\n\n return data;\n }\n\n // Legacy unencrypted format — migrate to encrypted on read\n if (file.license) {\n const data = file.license;\n // Re-save in encrypted format\n await saveLicense(data);\n return data;\n }\n\n return null;\n } catch {\n return null;\n }\n}\n\nexport async function saveLicense(data: LicenseData): Promise<void> {\n await ensureDataDirs();\n const { encrypted, iv, tag } = await encryptLicenseData(data);\n // SEG-002: Include machineId in the envelope for portability detection\n const machineId = await getMachineId();\n const file: Record<string, unknown> = { version: 1, encrypted, iv, tag, machineId };\n const tmpPath = LICENSE_PATH + '.tmp';\n await writeFile(tmpPath, JSON.stringify(file, null, 2), { encoding: 'utf-8', mode: 0o600 });\n await rename(tmpPath, LICENSE_PATH);\n}\n\nexport async function clearLicense(): Promise<void> {\n try {\n await rm(LICENSE_PATH);\n } catch { /* file may not exist */ }\n}\n\nexport function isExpired(license: LicenseData): boolean {\n if (!license.expiresAt) return false;\n const expiry = new Date(license.expiresAt).getTime();\n // Fail closed on corrupted/unparseable dates: NaN comparisons are always\n // false, so the previous version treated a garbage expiresAt as \"never\n // expires\", which is exploitable.\n if (isNaN(expiry)) return true;\n return expiry < Date.now();\n}\n\nexport function needsRevalidation(license: LicenseData): boolean {\n const lastValidated = new Date(license.lastValidatedAt).getTime();\n if (isNaN(lastValidated)) return true; // corrupted date → force revalidation\n return Date.now() - lastValidated > REVALIDATION_INTERVAL_MS;\n}\n\nexport function isWithinGracePeriod(license: LicenseData): boolean {\n const lastValidated = new Date(license.lastValidatedAt).getTime();\n if (isNaN(lastValidated)) return false; // corrupted date → no grace\n return Date.now() - lastValidated < GRACE_PERIOD_MS;\n}\n\n// ── Layer 15: Gradual degradation after extended offline ──\n\nexport type DegradationLevel = 'none' | 'warning' | 'limited' | 'expired';\nexport type RevalidationResult = 'valid' | 'grace' | 'expired';\n\n/**\n * Returns the degradation level based on time since last server validation.\n * - 0-7 days: none (full access)\n * - 7-14 days: warning (shows a notice but still works)\n * - 14-30 days: limited (some features disabled)\n * - 30+ days: expired (all Pro features disabled)\n */\nexport function getDegradationLevel(license: LicenseData): DegradationLevel {\n const lastValidated = new Date(license.lastValidatedAt).getTime();\n if (isNaN(lastValidated)) return 'expired'; // corrupted date → deny access\n const elapsed = Date.now() - lastValidated;\n if (elapsed < 0) return 'none'; // clock skew: future timestamp → treat as fresh\n const days = elapsed / (24 * 60 * 60 * 1000);\n\n if (days <= 7) return 'none';\n if (days <= 14) return 'warning';\n if (days <= 30) return 'limited';\n return 'expired';\n}\n\n// Layer 10: License key format validation\nfunction validateLicenseKey(key: string): void {\n // Polar keys are UUID-like: 8-4-4-4-12 hex chars or similar\n // Reject obviously invalid keys to avoid unnecessary API calls\n if (key.length < 10 || key.length > 100) {\n throw new Error('Invalid license key format');\n }\n // Only allow alphanumeric, hyphens, underscores\n if (!/^[\\w-]+$/.test(key)) {\n throw new Error('Invalid license key format');\n }\n}\n\n// Polar license-key benefits use distinct prefixes per tier:\n// Pro Monthly/Yearly → \"BTUI-...\"\n// Team Monthly/Yearly → \"BTUI-T-...\"\n// We detect the tier from the prefix instead of looking up the productId,\n// because Polar's customer-portal license endpoints don't echo product info\n// in the activation response.\nfunction detectPlan(key: string): 'pro' | 'team' {\n const upper = key.toUpperCase();\n return upper.startsWith('BTUI-T-') || upper.startsWith('BTUI-T_') ? 'team' : 'pro';\n}\n\nexport async function activate(key: string): Promise<LicenseData> {\n validateLicenseKey(key);\n checkRateLimit();\n\n let success = false;\n try {\n const res = await apiActivate(key);\n\n if (!res.activated) {\n throw new Error(res.error ?? 'Activation failed');\n }\n\n const license: LicenseData = {\n key,\n instanceId: res.instance.id,\n status: 'active',\n customerEmail: res.meta.customer_email,\n customerName: res.meta.customer_name,\n plan: detectPlan(key),\n activatedAt: new Date().toISOString(),\n expiresAt: res.license_key.expires_at,\n lastValidatedAt: new Date().toISOString(),\n };\n\n await saveLicense(license);\n success = true;\n return license;\n } finally {\n recordAttempt(success);\n }\n}\n\n/**\n * Revalidate the license against the server.\n * This also serves as Layer 19 (telemetry): each validation call\n * allows Polar to track activation count, last-seen timestamp,\n * and detect if the activation limit is exceeded (license sharing).\n */\n// EP-006: Detect if an error is a network error vs validation/contract error\nfunction isNetworkError(err: unknown): boolean {\n const msg = err instanceof Error ? err.message : String(err);\n return /fetch failed|ECONNREFUSED|ENOTFOUND|ETIMEDOUT|network|timeout|abort/i.test(msg);\n}\n\nexport async function revalidate(license: LicenseData): Promise<RevalidationResult> {\n try {\n const res = await apiValidate(license.key, license.instanceId);\n\n if (res.valid) {\n const updated: LicenseData = {\n ...license,\n lastValidatedAt: new Date().toISOString(),\n status: 'active',\n expiresAt: res.license_key.expires_at,\n };\n await saveLicense(updated);\n return 'valid';\n }\n\n await saveLicense({ ...license, status: 'expired' });\n return 'expired';\n } catch (err) {\n // EP-006: Network errors trigger grace period; validation/contract errors mean expired\n if (isNetworkError(err)) {\n return isWithinGracePeriod(license) ? 'grace' : 'expired';\n }\n // Unexpected response or contract violation — treat as expired\n await saveLicense({ ...license, status: 'expired' });\n return 'expired';\n }\n}\n\nexport async function deactivate(license: LicenseData): Promise<{ remoteSuccess: boolean }> {\n let remoteSuccess = false;\n for (let attempt = 0; attempt < 3; attempt++) {\n try {\n await apiDeactivate(license.key, license.instanceId);\n remoteSuccess = true;\n break;\n } catch {\n if (attempt < 2) await new Promise(r => setTimeout(r, 1000));\n }\n }\n await clearLicense();\n return { remoteSuccess };\n}\n","import type { PolarActivateResponse, PolarValidateResponse } from './types.js';\nimport { fetchWithRetry } from '../fetch-timeout.js';\nimport { getMachineId } from '../data-dir.js';\n\nconst BASE_URL = 'https://api.polar.sh/v1/customer-portal/license-keys';\n\n// ── GOV-004: Public organization ID (not a secret) ──\n// This is the public Polar organization identifier used for license key operations.\n// Found at: polar.sh/dashboard -> Settings -> General\nexport const POLAR_ORGANIZATION_ID = 'b8f245c0-d116-4457-92fb-1bda47139f82';\n\n// Polar product IDs (public, not secret) — useful for analytics, support, and\n// future server-side validation that wants to confirm what the customer bought.\nexport const POLAR_PRODUCT_IDS = {\n proMonthly: 'b925b882-464c-40c1-9ffd-b088ab31d9a3',\n proYearly: '8f97bb81-b950-4bc3-97c5-8133dd817d0b',\n teamMonthly: '7cf3fcb2-560d-4fbb-9936-15efac511b23',\n teamYearly: 'd096914d-902d-47b0-8d62-5c7e6fc4e087',\n} as const;\n\n// Public checkout URLs surfaced from the landing page and the CLI upgrade prompt.\n// Team links carry ?quantity=3 because Polar has no native min-seats enforcement\n// and the Team tier is sold from 3 seats up.\nexport const POLAR_CHECKOUT_URLS = {\n proMonthly: 'https://buy.polar.sh/polar_cl_QW1ZJ9887bU74drGr7JfujQfm3RKYnn1fuvc53DqD6D',\n proYearly: 'https://buy.polar.sh/polar_cl_yQsiUeDelyyEQznbWffD1j77JAyP24ra7iEVQ22PA4h',\n teamMonthly: 'https://buy.polar.sh/polar_cl_CO6xqSzKgFiQJwXnhZYGqisOP04Wspi0KKZSn38NjFZ?quantity=3',\n teamYearly: 'https://buy.polar.sh/polar_cl_BZowqmtaKwWEkRJNtBcashWg7oZOH6OhnnsJ204opNA?quantity=3',\n} as const;\n\n// Layer 11: API URL validation\nfunction validateApiUrl(url: string): void {\n const parsed = new URL(url);\n if (parsed.protocol !== 'https:') {\n throw new Error('HTTPS required for license API');\n }\n if (!parsed.hostname.endsWith('polar.sh')) {\n throw new Error('Invalid API host');\n }\n}\n\n// Raw Polar response shapes\ninterface PolarActivation {\n id: string; // activation_id\n license_key: {\n status: string;\n expires_at: string | null;\n };\n}\n\ninterface PolarValidated {\n id: string;\n status: string; // 'granted' | 'revoked' | 'disabled'\n expires_at: string | null;\n customer: {\n email: string | null;\n name: string | null;\n };\n activation: { id: string } | null;\n}\n\nasync function post<T>(endpoint: string, body: Record<string, unknown>, expectEmpty = false): Promise<T> {\n const url = `${BASE_URL}/${endpoint}`;\n validateApiUrl(url);\n\n const res = await fetchWithRetry(url, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(body),\n }, 15_000);\n\n if (!res.ok) {\n let message = `Request failed with status ${res.status}`;\n try {\n const errBody = await res.json() as { detail?: string; error?: string; message?: string };\n if (typeof errBody.detail === 'string') message = errBody.detail;\n else if (typeof errBody.error === 'string') message = errBody.error;\n else if (typeof errBody.message === 'string') message = errBody.message;\n } catch {\n // non-JSON error body — use generic message above\n }\n throw new Error(message);\n }\n\n if (expectEmpty || res.status === 204) return undefined as T;\n return res.json() as Promise<T>;\n}\n\nexport async function activateLicense(key: string): Promise<PolarActivateResponse> {\n const machineId = await getMachineId();\n\n const activation = await post<PolarActivation>('activate', {\n key,\n organization_id: POLAR_ORGANIZATION_ID,\n label: machineId, // SEG-004: Use machine UUID instead of hostname\n });\n\n // EP-001: Runtime validation of activation response\n if (!activation || typeof activation.id !== 'string' || !activation.license_key) {\n throw new Error('Invalid activation response: missing required fields');\n }\n\n // Polar's activate response doesn't include customer info — fetch it via validate\n let customerEmail = '';\n let customerName = '';\n try {\n const validated = await post<PolarValidated>('validate', {\n key,\n organization_id: POLAR_ORGANIZATION_ID,\n activation_id: activation.id,\n });\n customerEmail = validated.customer?.email ?? '';\n customerName = validated.customer?.name ?? '';\n } catch {\n // customer info is non-critical — activation still succeeds\n }\n\n return {\n activated: true,\n error: null,\n instance: { id: activation.id },\n license_key: {\n id: 0,\n status: activation.license_key.status,\n key,\n activation_limit: 0,\n activations_count: 0,\n expires_at: activation.license_key.expires_at,\n },\n meta: { customer_email: customerEmail, customer_name: customerName },\n };\n}\n\nexport async function validateLicense(key: string, instanceId: string): Promise<PolarValidateResponse> {\n const res = await post<PolarValidated>('validate', {\n key,\n organization_id: POLAR_ORGANIZATION_ID,\n activation_id: instanceId,\n });\n\n // EP-002: Runtime validation of validate response\n if (!res || typeof res.id !== 'string' || typeof res.status !== 'string' || !res.customer) {\n throw new Error('Invalid validation response: missing required fields');\n }\n\n const notExpired = res.expires_at === null || new Date(res.expires_at) > new Date();\n const valid = res.status === 'granted' && notExpired;\n\n return {\n valid,\n error: valid ? null : `License ${res.status}`,\n license_key: {\n id: 0,\n status: res.status,\n key,\n expires_at: res.expires_at,\n },\n instance: { id: instanceId },\n };\n}\n\nexport async function deactivateLicense(key: string, instanceId: string): Promise<void> {\n await post<void>(\n 'deactivate',\n { key, organization_id: POLAR_ORGANIZATION_ID, activation_id: instanceId },\n true,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAAA,WAAU,aAAAC,YAAW,UAAAC,eAAc;AAC5C,SAAS,QAAAC,aAAY;AACrB,SAAS,gBAAgB;;;ACFzB,SAAS,gBAAgB,kBAAkB,aAAa,YAAY,gBAAgB;AAcpF,IAAM,oBAAoB;AAC1B,IAAM,YAAY;AAElB,IAAM,WAAW,oBAAI,IAAoB;AACzC,IAAI,aAA4B;AAEhC,SAAS,oBAAoB,YAA4B;AACvD,QAAM,SAAS,SAAS,IAAI,UAAU;AACtC,MAAI,OAAQ,QAAO;AACnB,QAAM,UAAU,OAAO,KAAK,SAAS,UAAU,mBAAmB,WAAW,YAAY,EAAE,CAAC;AAC5F,WAAS,IAAI,YAAY,OAAO;AAChC,SAAO;AACT;AAI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AI;AAAA,QACxC,GAAG;AAAA,QACH,UAAU;AAAA,UACR,GAAG,aAAa;AAAA,UAChB,OAAO,aAAa,SAAS,MAAM;AAAA,YAAI,CAAC,MACtC,EAAE,SAAS,SAAS,cAChB,EAAE,GAAG,GAAG,SAAS,SAAS,cAAc,IACxC;AAAA,UACN;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,QAAM,aAAa,MAAM,sBAAsB;AAC/C,QAAM,cAAc,gBAAgB,UAAU;AAC9C,SAAO,KAAK,sCAAsC,EAAE,OAAO,YAAY,OAAO,CAAC;AACjF;","names":["readFile","writeFile","rename","join","readFile","writeFile","rename","createCipheriv","createDecipheriv","randomBytes","scryptSync","hkdfSync","ENCRYPTION_SECRET","HKDF_SALT","_legacyKey","deriveEncryptionKey","hkdfSync","deriveLegacyKey","scryptSync","randomBytes","createCipheriv","createDecipheriv","readFile","writeFile","rename","join","readFile","writeFile","rename"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/history/history-logger.ts"],"sourcesContent":["import { readFile, writeFile, rename, open, unlink } from 'node:fs/promises';\nimport { randomUUID } from 'node:crypto';\nimport { HISTORY_PATH, ensureDataDirs } from '../data-dir.js';\nimport type { HistoryEntry, HistoryFile, HistoryAction } from './types.js';\n\nconst MAX_ENTRIES = 1000;\n\nfunction assertPro(isPro: boolean): void {\n if (!isPro) throw new Error('Pro license required');\n}\n\n// ── BK-004: Simple file locking ──\nconst lockPath = HISTORY_PATH + '.lock';\n\nasync function withLock<T>(fn: () => Promise<T>): Promise<T> {\n const lockFd = await open(lockPath, 'wx').catch(() => null);\n if (!lockFd) throw new Error('History file is locked by another process');\n try {\n return await fn();\n } finally {\n await lockFd.close();\n await unlink(lockPath).catch(() => {});\n }\n}\n\n/** Map brew subcommand to a history action type */\nexport function detectAction(args: string[]): { action: HistoryAction; packageName: string | null } | null {\n const cmd = args[0];\n if (cmd === 'install') return { action: 'install', packageName: args[1] ?? null };\n if (cmd === 'uninstall') {\n const name = args.find((a) => !a.startsWith('-')) === 'uninstall'\n ? args.find((a, i) => i > 0 && !a.startsWith('-')) ?? null\n : args[1] ?? null;\n return { action: 'uninstall', packageName: name };\n }\n if (cmd === 'upgrade') {\n if (args.length === 1) return { action: 'upgrade-all', packageName: null };\n return { action: 'upgrade', packageName: args[1] ?? null };\n }\n return null;\n}\n\nexport async function loadHistory(isPro: boolean): Promise<HistoryEntry[]> {\n assertPro(isPro);\n\n try {\n const raw = await readFile(HISTORY_PATH, 'utf-8');\n const file = JSON.parse(raw) as HistoryFile;\n if (file.version !== 1) {\n // Future: add migration logic here\n throw new Error('Unsupported data version');\n }\n const entries = file.entries;\n return Array.isArray(entries) ? entries : [];\n } catch {\n return [];\n }\n}\n\nasync function saveHistory(entries: HistoryEntry[]): Promise<void> {\n await ensureDataDirs();\n const file: HistoryFile = { version: 1, entries };\n const tmp = HISTORY_PATH + '.tmp';\n await writeFile(tmp, JSON.stringify(file, null, 2), { encoding: 'utf-8', mode: 0o600 });\n await rename(tmp, HISTORY_PATH);\n}\n\nexport async function appendEntry(\n isPro: boolean,\n action: HistoryAction,\n packageName: string | null,\n success: boolean,\n error: string | null = null,\n): Promise<void> {\n assertPro(isPro);\n\n await withLock(async () => {\n const entries = await loadHistory(isPro);\n\n const entry: HistoryEntry = {\n id: randomUUID(),\n action,\n packageName,\n timestamp: new Date().toISOString(),\n success,\n error,\n };\n\n entries.unshift(entry);\n\n if (entries.length > MAX_ENTRIES) {\n entries.length = MAX_ENTRIES;\n }\n\n await saveHistory(entries);\n });\n}\n\nexport async function clearHistory(isPro: boolean): Promise<void> {\n assertPro(isPro);\n await saveHistory([]);\n}\n"],"mappings":";;;;;;AAAA,SAAS,UAAU,WAAW,QAAQ,MAAM,cAAc;AAC1D,SAAS,kBAAkB;AAI3B,IAAM,cAAc;AAEpB,SAAS,UAAU,OAAsB;AACvC,MAAI,CAAC,MAAO,OAAM,IAAI,MAAM,sBAAsB;AACpD;AAGA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ACV;AACF;AAEA,eAAe,YAAY,SAAwC;AACjE,QAAM,eAAe;AACrB,QAAM,OAAoB,EAAE,SAAS,GAAG,QAAQ;AAChD,QAAM,MAAM,eAAe;AAC3B,QAAM,UAAU,KAAK,KAAK,UAAU,MAAM,MAAM,CAAC,GAAG,EAAE,UAAU,SAAS,MAAM,IAAM,CAAC;AACtF,QAAM,OAAO,KAAK,YAAY;AAChC;AAEA,eAAsB,YACpB,OACA,QACA,aACA,SACA,QAAuB,MACR;AACf,YAAU,KAAK;AAEf,QAAM,SAAS,YAAY;AACzB,UAAM,UAAU,MAAM,YAAY,KAAK;AAEvC,UAAM,QAAsB;AAAA,MAC1B,IAAI,WAAW;AAAA,MACf;AAAA,MACA;AAAA,MACA,YAAW,oBAAI,KAAK,GAAE,YAAY;AAAA,MAClC;AAAA,MACA;AAAA,IACF;AAEA,YAAQ,QAAQ,KAAK;AAErB,QAAI,QAAQ,SAAS,aAAa;AAChC,cAAQ,SAAS;AAAA,IACnB;AAEA,UAAM,YAAY,OAAO;AAAA,EAC3B,CAAC;AACH;AAEA,eAAsB,aAAa,OAA+B;AAChE,YAAU,KAAK;AACf,QAAM,YAAY,CAAC,CAAC;AACtB;","names":[]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
checkCompliance,
|
|
3
|
-
versionAtLeast
|
|
4
|
-
} from "./chunk-5MYWF5D7.js";
|
|
5
|
-
import "./chunk-PVSE6XO7.js";
|
|
6
|
-
import "./chunk-EHIBIFCB.js";
|
|
7
|
-
import "./chunk-KDHEUNRI.js";
|
|
8
|
-
export {
|
|
9
|
-
checkCompliance,
|
|
10
|
-
versionAtLeast
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=compliance-checker-7NMFKWTI.js.map
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|