sourcecode 1.59.0__tar.gz → 1.60.0__tar.gz
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.
- {sourcecode-1.59.0 → sourcecode-1.60.0}/CHANGELOG.md +15 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/PKG-INFO +3 -3
- {sourcecode-1.59.0 → sourcecode-1.60.0}/README.md +2 -2
- {sourcecode-1.59.0 → sourcecode-1.60.0}/pyproject.toml +1 -1
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/__init__.py +1 -1
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/cli.py +18 -17
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/license.py +1 -1
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/telemetry/__init__.py +3 -3
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/telemetry/config.py +30 -4
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/telemetry/consent.py +18 -21
- {sourcecode-1.59.0 → sourcecode-1.60.0}/.github/workflows/build-windows.yml +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/.gitignore +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/.ruff.toml +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/CONTRIBUTING.md +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/LICENSE +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/SECURITY.md +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/raw +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/adaptive_scanner.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/architecture_analyzer.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/architecture_summary.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/ast_extractor.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/cache.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/canonical_ir.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/cir_graphs.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/classifier.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/code_notes_analyzer.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/confidence_analyzer.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/context_scorer.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/context_summarizer.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/contract_model.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/contract_pipeline.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/coverage_parser.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/dependency_analyzer.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/detectors/__init__.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/detectors/base.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/detectors/csproj_parser.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/detectors/dart.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/detectors/dotnet.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/detectors/elixir.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/detectors/go.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/detectors/heuristic.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/detectors/hybrid.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/detectors/java.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/detectors/jvm_ext.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/detectors/nodejs.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/detectors/parsers.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/detectors/php.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/detectors/project.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/detectors/python.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/detectors/ruby.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/detectors/rust.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/detectors/systems.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/detectors/terraform.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/detectors/tooling.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/doc_analyzer.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/entrypoint_classifier.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/env_analyzer.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/error_schema.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/explain.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/file_chunker.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/file_classifier.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/flow_analyzer.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/format_contract.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/fqn_utils.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/git_analyzer.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/graph_analyzer.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/integration_detector.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/mcp/__init__.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/mcp/onboarding/__init__.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/mcp/onboarding/applier.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/mcp/onboarding/backup.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/mcp/onboarding/detector.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/mcp/onboarding/planner.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/mcp/orchestrator.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/mcp/registry.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/mcp/runner.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/mcp/server.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/mcp_nudge.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/metrics_analyzer.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/migrate_check.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/openapi_surface.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/output_budget.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/path_filters.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/pr_comment_renderer.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/pr_impact.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/prepare_context.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/progress.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/ranking_engine.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/redactor.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/relevance_scorer.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/rename_refactor.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/repo_classifier.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/repository_ir.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/ris.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/runtime_classifier.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/scanner.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/schema.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/security_config.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/semantic_analyzer.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/serializer.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/spring_event_topology.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/spring_findings.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/spring_impact.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/spring_model.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/spring_security_audit.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/spring_semantic.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/spring_tx_analyzer.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/summarizer.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/telemetry/events.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/telemetry/filters.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/telemetry/transport.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/tree_utils.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/validation_surface.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/version_check.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/src/sourcecode/workspace.py +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/supabase/functions/README.md +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/supabase/functions/get-license/index.ts +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/supabase/functions/lemonsqueezy-webhook/index.ts +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/supabase/functions/telemetry/index.ts +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/supabase/sql/license_event_ordering.sql +0 -0
- {sourcecode-1.59.0 → sourcecode-1.60.0}/supabase/sql/telemetry_events.sql +0 -0
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.60.0] — 2026-06-29
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
- **Anonymous telemetry is now on by default (opt-out).** Previously telemetry
|
|
7
|
+
was strictly opt-in and disabled until the user accepted a y/N consent prompt.
|
|
8
|
+
It now defaults to **on** so usage metrics flow without an extra step, while
|
|
9
|
+
staying fully anonymous — no source code, paths, file names, secrets, or
|
|
10
|
+
repository content are ever collected. The first interactive run shows a
|
|
11
|
+
one-time **notice** (not a prompt) explaining what is collected and how to
|
|
12
|
+
disable. Disable any time with `sourcecode telemetry disable`,
|
|
13
|
+
`SOURCECODE_TELEMETRY=0`, or the `DO_NOT_TRACK=1` convention. With no explicit
|
|
14
|
+
choice, telemetry still defaults to **off in CI** (no human to see the notice);
|
|
15
|
+
an explicit opt-in is honored everywhere. README, `--help`, and
|
|
16
|
+
`docs/privacy.md` updated accordingly.
|
|
17
|
+
|
|
3
18
|
## [1.59.0] — 2026-06-19
|
|
4
19
|
|
|
5
20
|
### Fixed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sourcecode
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.60.0
|
|
4
4
|
Summary: Persistent structural context and ultra-fast repeated analysis for AI coding agents
|
|
5
5
|
License-File: LICENSE
|
|
6
6
|
Keywords: agents,ai,codebase,context,developer-tools,llm
|
|
@@ -742,7 +742,7 @@ All outputs include:
|
|
|
742
742
|
|
|
743
743
|
## Telemetry
|
|
744
744
|
|
|
745
|
-
Anonymous, opt-
|
|
745
|
+
Anonymous, **on by default (opt-out)**. Collects: version, OS, commands, flags, duration, repo size range, errors. No source code, paths, secrets, or output content. A one-time notice is shown on first interactive run.
|
|
746
746
|
|
|
747
747
|
```bash
|
|
748
748
|
sourcecode telemetry status
|
|
@@ -750,7 +750,7 @@ sourcecode telemetry enable
|
|
|
750
750
|
sourcecode telemetry disable
|
|
751
751
|
```
|
|
752
752
|
|
|
753
|
-
|
|
753
|
+
Disable any time: `export SOURCECODE_TELEMETRY=0` (or `DO_NOT_TRACK=1`)
|
|
754
754
|
|
|
755
755
|
---
|
|
756
756
|
|
|
@@ -704,7 +704,7 @@ All outputs include:
|
|
|
704
704
|
|
|
705
705
|
## Telemetry
|
|
706
706
|
|
|
707
|
-
Anonymous, opt-
|
|
707
|
+
Anonymous, **on by default (opt-out)**. Collects: version, OS, commands, flags, duration, repo size range, errors. No source code, paths, secrets, or output content. A one-time notice is shown on first interactive run.
|
|
708
708
|
|
|
709
709
|
```bash
|
|
710
710
|
sourcecode telemetry status
|
|
@@ -712,7 +712,7 @@ sourcecode telemetry enable
|
|
|
712
712
|
sourcecode telemetry disable
|
|
713
713
|
```
|
|
714
714
|
|
|
715
|
-
|
|
715
|
+
Disable any time: `export SOURCECODE_TELEMETRY=0` (or `DO_NOT_TRACK=1`)
|
|
716
716
|
|
|
717
717
|
---
|
|
718
718
|
|
|
@@ -584,7 +584,7 @@ try:
|
|
|
584
584
|
except Exception:
|
|
585
585
|
pass
|
|
586
586
|
|
|
587
|
-
telemetry_app = typer.Typer(help="Manage anonymous telemetry (opt-
|
|
587
|
+
telemetry_app = typer.Typer(help="Manage anonymous telemetry (on by default; opt-out).", rich_markup_mode="rich")
|
|
588
588
|
app.add_typer(telemetry_app, name="telemetry")
|
|
589
589
|
|
|
590
590
|
mcp_app = typer.Typer(help="MCP integration: setup, status, serve, remove.", rich_markup_mode="rich")
|
|
@@ -597,18 +597,18 @@ auth_app = typer.Typer(help="Authentication: status, logout.", rich_markup_mode=
|
|
|
597
597
|
app.add_typer(auth_app, name="auth")
|
|
598
598
|
|
|
599
599
|
|
|
600
|
-
def
|
|
601
|
-
"""Show first-run
|
|
600
|
+
def _maybe_show_telemetry_notice() -> None:
|
|
601
|
+
"""Show first-run telemetry notice once, on interactive TTYs only.
|
|
602
|
+
|
|
603
|
+
Telemetry is on by default (opt-out). We inform rather than ask, then
|
|
604
|
+
mark the notice as shown so it appears only once.
|
|
605
|
+
"""
|
|
602
606
|
try:
|
|
603
|
-
from sourcecode.telemetry.config import has_been_asked,
|
|
604
|
-
from sourcecode.telemetry.consent import
|
|
607
|
+
from sourcecode.telemetry.config import has_been_asked, mark_asked
|
|
608
|
+
from sourcecode.telemetry.consent import show_first_run_notice
|
|
605
609
|
if not has_been_asked():
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
if enabled:
|
|
609
|
-
typer.echo("Telemetry enabled. Thank you. Disable: sourcecode telemetry disable", err=True)
|
|
610
|
-
else:
|
|
611
|
-
typer.echo("Telemetry disabled. Enable anytime: sourcecode telemetry enable", err=True)
|
|
610
|
+
show_first_run_notice()
|
|
611
|
+
mark_asked()
|
|
612
612
|
except Exception:
|
|
613
613
|
pass
|
|
614
614
|
|
|
@@ -1020,9 +1020,9 @@ def main(
|
|
|
1020
1020
|
sourcecode /path/to/repo --compact analyze specific path
|
|
1021
1021
|
sourcecode --agent agent-optimized output (full detail)
|
|
1022
1022
|
"""
|
|
1023
|
-
# First-run
|
|
1023
|
+
# First-run telemetry notice (skip for telemetry/version/config subcommands)
|
|
1024
1024
|
if ctx.invoked_subcommand not in ("telemetry", "version", "config"):
|
|
1025
|
-
|
|
1025
|
+
_maybe_show_telemetry_notice()
|
|
1026
1026
|
_maybe_show_mcp_hint()
|
|
1027
1027
|
|
|
1028
1028
|
# When a subcommand is invoked, skip the main analysis.
|
|
@@ -3342,12 +3342,12 @@ def telemetry_status() -> None:
|
|
|
3342
3342
|
enabled = is_enabled()
|
|
3343
3343
|
asked = has_been_asked()
|
|
3344
3344
|
status = "enabled" if enabled else "disabled"
|
|
3345
|
-
typer.echo(f"Telemetry: {status}")
|
|
3345
|
+
typer.echo(f"Telemetry: {status} (on by default; opt-out)")
|
|
3346
3346
|
if not asked:
|
|
3347
|
-
typer.echo(" (
|
|
3347
|
+
typer.echo(" (first-run notice not yet shown — will show on next run)")
|
|
3348
3348
|
typer.echo(f" Config: {config_file_path()}")
|
|
3349
|
-
typer.echo(" Disable
|
|
3350
|
-
typer.echo(" Or set env var:
|
|
3349
|
+
typer.echo(" Disable: sourcecode telemetry disable")
|
|
3350
|
+
typer.echo(" Or set env var: SOURCECODE_TELEMETRY=0 (or DO_NOT_TRACK=1)")
|
|
3351
3351
|
|
|
3352
3352
|
|
|
3353
3353
|
@telemetry_app.command("enable")
|
|
@@ -3369,6 +3369,7 @@ def telemetry_disable() -> None:
|
|
|
3369
3369
|
from sourcecode.telemetry.config import set_enabled
|
|
3370
3370
|
set_enabled(False)
|
|
3371
3371
|
typer.echo("Telemetry disabled. No data will be collected or sent.")
|
|
3372
|
+
typer.echo("Telemetry is on by default; this opt-out is remembered.")
|
|
3372
3373
|
typer.echo("Re-enable at any time: sourcecode telemetry enable")
|
|
3373
3374
|
|
|
3374
3375
|
|
|
@@ -372,7 +372,7 @@ _init()
|
|
|
372
372
|
# ---------------------------------------------------------------------------
|
|
373
373
|
|
|
374
374
|
def _emit_telemetry(event: str, **kw: object) -> None:
|
|
375
|
-
"""Best-effort telemetry emit. Respects opt-
|
|
375
|
+
"""Best-effort telemetry emit. Respects the user's opt-out; never raises or blocks."""
|
|
376
376
|
try:
|
|
377
377
|
from sourcecode import telemetry as _tel
|
|
378
378
|
_tel.record(event, **kw) # type: ignore[arg-type]
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"""sourcecode telemetry —
|
|
1
|
+
"""sourcecode telemetry — anonymous usage metrics, on by default (opt-out).
|
|
2
2
|
|
|
3
3
|
Public API:
|
|
4
4
|
is_enabled() → bool
|
|
5
5
|
record(event, **kw) → None (fire-and-forget)
|
|
6
6
|
session_id() → str (ephemeral 8-char hex, new each process)
|
|
7
7
|
|
|
8
|
-
Telemetry is
|
|
9
|
-
|
|
8
|
+
Telemetry is enabled by default and stays anonymous. It can be disabled at any
|
|
9
|
+
time via `sourcecode telemetry disable`, SOURCECODE_TELEMETRY=0, or DO_NOT_TRACK=1.
|
|
10
10
|
|
|
11
11
|
Nothing sensitive (code, paths, secrets, output) is ever collected.
|
|
12
12
|
See docs/privacy.md for full details.
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"""Persistent telemetry configuration.
|
|
2
2
|
|
|
3
|
+
Telemetry is enabled by default (opt-out). It stays anonymous and never
|
|
4
|
+
collects source code, paths, secrets or repository content.
|
|
5
|
+
|
|
3
6
|
Config file: ~/.config/sourcecode/config.json
|
|
7
|
+
Disable: `sourcecode telemetry disable`, SOURCECODE_TELEMETRY=0, or DO_NOT_TRACK=1
|
|
4
8
|
Env override: SOURCECODE_TELEMETRY=0 (disable) or =1 (enable)
|
|
5
9
|
"""
|
|
6
10
|
|
|
@@ -14,6 +18,18 @@ from typing import Any
|
|
|
14
18
|
_ENV_VAR = "SOURCECODE_TELEMETRY"
|
|
15
19
|
_CONFIG_FILE = Path.home() / ".config" / "sourcecode" / "config.json"
|
|
16
20
|
|
|
21
|
+
# CI markers — when no explicit choice has been made, telemetry defaults OFF
|
|
22
|
+
# in CI (no human to see the first-run notice), ON otherwise.
|
|
23
|
+
_CI_VARS = (
|
|
24
|
+
"CI", "CONTINUOUS_INTEGRATION", "GITHUB_ACTIONS", "CIRCLECI",
|
|
25
|
+
"TRAVIS", "JENKINS_URL", "BUILDKITE", "GITLAB_CI", "TF_BUILD",
|
|
26
|
+
"TEAMCITY_VERSION", "DRONE", "SEMAPHORE",
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _in_ci() -> bool:
|
|
31
|
+
return any(os.environ.get(v) for v in _CI_VARS)
|
|
32
|
+
|
|
17
33
|
|
|
18
34
|
def _load() -> dict[str, Any]:
|
|
19
35
|
try:
|
|
@@ -31,17 +47,27 @@ def _save(data: dict[str, Any]) -> None:
|
|
|
31
47
|
|
|
32
48
|
|
|
33
49
|
def is_enabled() -> bool:
|
|
34
|
-
"""True
|
|
50
|
+
"""True unless telemetry has been explicitly disabled.
|
|
35
51
|
|
|
36
|
-
|
|
37
|
-
|
|
52
|
+
Telemetry is enabled by default (opt-out). Precedence, highest first:
|
|
53
|
+
1. SOURCECODE_TELEMETRY env var (0 = off, 1 = on)
|
|
54
|
+
2. DO_NOT_TRACK env var (any value other than ""/"0" turns it off)
|
|
55
|
+
3. config file 'enabled' flag, if the user has made an explicit choice
|
|
56
|
+
4. default: True — except in CI, where it defaults to False
|
|
38
57
|
"""
|
|
39
58
|
env = os.environ.get(_ENV_VAR, "").strip()
|
|
40
59
|
if env == "0":
|
|
41
60
|
return False
|
|
42
61
|
if env == "1":
|
|
43
62
|
return True
|
|
44
|
-
|
|
63
|
+
dnt = os.environ.get("DO_NOT_TRACK", "").strip()
|
|
64
|
+
if dnt not in ("", "0"):
|
|
65
|
+
return False
|
|
66
|
+
stored = _load().get("telemetry", {}).get("enabled")
|
|
67
|
+
if stored is not None:
|
|
68
|
+
return bool(stored)
|
|
69
|
+
# No explicit choice yet: on by default, off under CI.
|
|
70
|
+
return not _in_ci()
|
|
45
71
|
|
|
46
72
|
|
|
47
73
|
def has_been_asked() -> bool:
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
"""First-run
|
|
1
|
+
"""First-run telemetry notice.
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Telemetry is enabled by default (opt-out) and stays anonymous. The notice is
|
|
4
|
+
shown exactly once, only on interactive TTYs, to inform the user that
|
|
5
|
+
telemetry is on and how to turn it off. It does not ask a question — it
|
|
6
|
+
informs and respects the user's right to disable.
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
Notice is written to stderr so it doesn't pollute stdout output.
|
|
7
9
|
"""
|
|
8
10
|
|
|
9
11
|
from __future__ import annotations
|
|
@@ -11,11 +13,11 @@ from __future__ import annotations
|
|
|
11
13
|
import os
|
|
12
14
|
import sys
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
_NOTICE = """\
|
|
15
17
|
\033[2m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
16
|
-
sourcecode —
|
|
18
|
+
sourcecode — anonymous telemetry is ON by default
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
Anonymous usage metrics help improve sourcecode.
|
|
19
21
|
|
|
20
22
|
Collected: tool version, Python version, OS, commands used,
|
|
21
23
|
flags used, approximate repo size, execution duration, errors.
|
|
@@ -23,9 +25,9 @@ _PROMPT = """\
|
|
|
23
25
|
Never collected: source code, file paths, file names, secrets,
|
|
24
26
|
tokens, environment variables, or any repository content.
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
Disable at any time:
|
|
27
29
|
sourcecode telemetry disable
|
|
28
|
-
export SOURCECODE_TELEMETRY=0
|
|
30
|
+
export SOURCECODE_TELEMETRY=0 (or DO_NOT_TRACK=1)
|
|
29
31
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\033[0m
|
|
30
32
|
"""
|
|
31
33
|
|
|
@@ -43,21 +45,16 @@ def _is_interactive() -> bool:
|
|
|
43
45
|
return not any(os.environ.get(v) for v in ci_vars)
|
|
44
46
|
|
|
45
47
|
|
|
46
|
-
def
|
|
47
|
-
"""
|
|
48
|
+
def show_first_run_notice() -> None:
|
|
49
|
+
"""Print the one-time telemetry notice on interactive terminals.
|
|
48
50
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
Never raises. Does nothing on non-interactive / CI environments.
|
|
52
|
+
Telemetry stays enabled regardless — this only informs the user.
|
|
51
53
|
"""
|
|
52
54
|
if not _is_interactive():
|
|
53
|
-
return
|
|
54
|
-
|
|
55
|
+
return
|
|
55
56
|
try:
|
|
56
|
-
sys.stderr.write(
|
|
57
|
-
sys.stderr.write(" Enable anonymous telemetry? [y/N]: ")
|
|
57
|
+
sys.stderr.write(_NOTICE)
|
|
58
58
|
sys.stderr.flush()
|
|
59
|
-
answer = sys.stdin.readline().strip().lower()
|
|
60
|
-
sys.stderr.write("\n")
|
|
61
|
-
return answer == "y"
|
|
62
59
|
except Exception:
|
|
63
|
-
|
|
60
|
+
pass
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|