head 1.1; access; symbols; locks; strict; comment @# @; 1.1 date 2026.06.23.09.03.37; author pin; state Exp; branches; next ; commitid 9niW2f4By3qUYTKG; desc @@ 1.1 log @devel/sem: import package Packaged in wip mostly by wiz@@ with some mods from myself. sem is a semantic version control tool that works on top of Git. It parses your code with tree-sitter, extracts every function, class, and method as an entity, and diffs at the entity level instead of lines. This means you see "function blahh was modified" instead of "lines x-y changed." It works in any Git repo with no setup. @ text @$NetBSD$ Set telemetry as opt-in instead of opt-out. Patch taken from FreeBSD ports. --- src/telemetry.rs.orig 2026-06-23 08:19:43.373694926 +0000 +++ src/telemetry.rs @@@@ -37,10 +37,14 @@@@ fn telemetry_disabled() -> bool { } fn telemetry_disabled() -> bool { - let set = |var: &str| std::env::var(var).is_ok_and(|v| !v.is_empty() && v != "0"); - set("SEM_NO_TELEMETRY") || set("DO_NOT_TRACK") || is_development_build() + !telemetry_enabled() } +fn telemetry_enabled() -> bool { + let disabled = |var: &str| std::env::var(var).is_ok_and(|v| !v.is_empty() && v == "0"); + !is_development_build() && (disabled("SEM_NO_TELEMETRY") || disabled("DO_NOT_TRACK")) +} + /// True when this binary is a development build rather than a real install, /// so our own work never pollutes usage data. Catches: debug builds /// (`cargo run`, `cargo test`), and any binary run straight out of a Cargo @@@@ -119,7 +123,7 @@@@ pub fn record(command: &str) { /// Record one command invocation. Cheap (two small file ops); never blocks /// on the network. Call once per CLI run before dispatch. pub fn record(command: &str) { - if telemetry_disabled() { + if telemetry_enabled() { return; } @@@@ -129,7 +133,7 @@@@ pub fn record(command: &str) { } if !state.notice_shown { eprintln!( - "sem collects anonymous usage data (command names only, never code or repo names). Set SEM_NO_TELEMETRY=1 to disable." + "If enabled, sem collects anonymous usage data (command names only, never code or repo names). Set SEM_NO_TELEMETRY=0 to enable telemetry." ); state.notice_shown = true; save_state(&state); @