sourcecode 1.59.0__py3-none-any.whl → 1.60.0__py3-none-any.whl

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/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """sourcecode — Deterministic codebase context maps for AI coding agents."""
2
2
 
3
- __version__ = "1.59.0"
3
+ __version__ = "1.60.0"
sourcecode/cli.py CHANGED
@@ -584,7 +584,7 @@ try:
584
584
  except Exception:
585
585
  pass
586
586
 
587
- telemetry_app = typer.Typer(help="Manage anonymous telemetry (opt-in).", rich_markup_mode="rich")
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 _maybe_ask_consent() -> None:
601
- """Show first-run consent prompt once, on interactive TTYs only."""
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, set_enabled
604
- from sourcecode.telemetry.consent import ask_for_consent
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
- enabled = ask_for_consent()
607
- set_enabled(enabled)
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 consent (skip for telemetry/version/config subcommands)
1023
+ # First-run telemetry notice (skip for telemetry/version/config subcommands)
1024
1024
  if ctx.invoked_subcommand not in ("telemetry", "version", "config"):
1025
- _maybe_ask_consent()
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(" (consent not yet shown — will prompt on next run)")
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 permanently: sourcecode telemetry disable")
3350
- typer.echo(" Or set env var: SOURCECODE_TELEMETRY=0")
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
 
sourcecode/license.py CHANGED
@@ -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-in; never raises or blocks."""
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 — opt-in anonymous usage metrics.
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 strictly opt-in. It is disabled by default and can be disabled
9
- at any time via `sourcecode telemetry disable` or SOURCECODE_TELEMETRY=0.
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 only when telemetry is explicitly opted in.
50
+ """True unless telemetry has been explicitly disabled.
35
51
 
36
- Env var takes absolute precedence over config file.
37
- Default is always disabled telemetry is strictly opt-in.
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
- return bool(_load().get("telemetry", {}).get("enabled", False))
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 consent prompt.
1
+ """First-run telemetry notice.
2
2
 
3
- Shown exactly once, only on interactive TTYs, only when the user hasn't been
4
- asked before. Default answer is NO the user must explicitly type 'y' to opt in.
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
- Prompt is written to stderr so it doesn't pollute stdout output.
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
- _PROMPT = """\
16
+ _NOTICE = """\
15
17
  \033[2m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
16
- sourcecode — optional anonymous telemetry
18
+ sourcecode — anonymous telemetry is ON by default
17
19
 
18
- Help improve sourcecode by sharing anonymous usage metrics.
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
- You can change this at any time:
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 ask_for_consent() -> bool:
47
- """Show the consent prompt and return the user's choice.
48
+ def show_first_run_notice() -> None:
49
+ """Print the one-time telemetry notice on interactive terminals.
48
50
 
49
- Returns True if the user opted in, False otherwise.
50
- Never raises. Default (Enter / non-y input) is False.
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 False
54
-
55
+ return
55
56
  try:
56
- sys.stderr.write(_PROMPT)
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
- return False
60
+ pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sourcecode
3
- Version: 1.59.0
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-in. Collects: version, OS, commands, flags, duration, repo size range, errors. No source code, paths, secrets, or output content.
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
- Or: `export SOURCECODE_TELEMETRY=0`
753
+ Disable any time: `export SOURCECODE_TELEMETRY=0` (or `DO_NOT_TRACK=1`)
754
754
 
755
755
  ---
756
756
 
@@ -1,4 +1,4 @@
1
- sourcecode/__init__.py,sha256=2epIg2XeTy7k3HoxrmwEPHso7xkeVSRJ3jh1LHHjjkU,103
1
+ sourcecode/__init__.py,sha256=K2X8G7LVjuV1hmr12r2Qonlfz5_JfYRcVzSPr6Z564k,103
2
2
  sourcecode/adaptive_scanner.py,sha256=XffluXKzJUXrMtjEiAOnSNPZnztdIcts17T9ouHeID0,10521
3
3
  sourcecode/architecture_analyzer.py,sha256=liCwQmLgb5vplohy8arjYxs_HOIv5C9MjLh_gY6bc5Q,44115
4
4
  sourcecode/architecture_summary.py,sha256=z34_6v7cSwy98cof2UVciGho7SCrZ93tiqMmq5WNzRQ,20405
@@ -7,7 +7,7 @@ sourcecode/cache.py,sha256=1V3vsaODAa2UBJAC0xpvxpmRdriCezQx5Q8JCcfgziE,31892
7
7
  sourcecode/canonical_ir.py,sha256=DEwucOPJguLsVtg5cV8mWXNi112l5jmBhv73KGGebVk,24849
8
8
  sourcecode/cir_graphs.py,sha256=9G0HHj1kw2325IDyzo2OpX73BNswEckecf4MZUXB4JM,12078
9
9
  sourcecode/classifier.py,sha256=hKzg-nQ47htqqIUzSGvYxv15cXrA3KgICTwJmdqal0o,8095
10
- sourcecode/cli.py,sha256=PpqOLcYhNljXCJ0V_RjO9RgsgjzgtDK5jIDTqI3Hk6k,275872
10
+ sourcecode/cli.py,sha256=9JLQ0OgRBwWa4Cf2ufpk9gKOpI3mx6t8yZSxqpF_kXw,275902
11
11
  sourcecode/code_notes_analyzer.py,sha256=EJemNCNc9Dn-1RZYu-aNbK0ELzmsyC4s6FdHi3XyNEI,9392
12
12
  sourcecode/confidence_analyzer.py,sha256=_jckZSxksV-OU38vbkxfVNBnWCtlCq8Vwfg23x1uspA,19054
13
13
  sourcecode/context_scorer.py,sha256=QpChSpsmaAYz91rXA4Ue5xzQmNz_ZboZN09YOHScq1U,14679
@@ -29,7 +29,7 @@ sourcecode/fqn_utils.py,sha256=XLU7zDkNBXz_RZkIUNfpPmp1nekWtqP-fxV92tDV1vg,2158
29
29
  sourcecode/git_analyzer.py,sha256=JStxTQXNjBWi_wLdwhsZs9mT-v50cSJIz4Agzn6Kh9I,13362
30
30
  sourcecode/graph_analyzer.py,sha256=DHR8fY69oU_Pi4SYaWboX6EoEFrctQKB9dsjpqwGMzw,62403
31
31
  sourcecode/integration_detector.py,sha256=ZJqrGwvZ4ee2JTGhlazKk67aZi173HxkhNpl8Yntpd8,6503
32
- sourcecode/license.py,sha256=vN7XQb0IY2rxkdsn7LC-Uz2m5f9tNPiJ9JlSVdhpwus,23488
32
+ sourcecode/license.py,sha256=wckiLuiwaE35KMCStUf1gYzleJuFe6qsSyxUQJvit3s,23500
33
33
  sourcecode/mcp_nudge.py,sha256=5ELU_ixzh6uA83NXLOZT8h00OhL53okfQdji3jyKOjg,2917
34
34
  sourcecode/metrics_analyzer.py,sha256=m0ENgtqKeBL17kUIK3fmGkgo7UfXBNHxCMj0H_Y5K7c,22750
35
35
  sourcecode/migrate_check.py,sha256=H8iy7Vk8cGL0dnR3ZkFPS20CtfF5LJWuzQVQE4awQ9s,56192
@@ -96,14 +96,14 @@ sourcecode/mcp/onboarding/applier.py,sha256=B9CneieWTpaDSDIyW3S5nrlRlBpvfqUcgi93
96
96
  sourcecode/mcp/onboarding/backup.py,sha256=ihqGOR8QTX8HASRSEDyfFyXr5bkXrygPHamv4p9KTmk,1452
97
97
  sourcecode/mcp/onboarding/detector.py,sha256=kDc0U6kXMuq_GivqwKrgJzIVLVeoLr3RQl63ksW10I8,3327
98
98
  sourcecode/mcp/onboarding/planner.py,sha256=Fopg5f72FDiPfldF7NOxYjcBA_w8hi_jBJpSz39lPb8,1332
99
- sourcecode/telemetry/__init__.py,sha256=rth1GuU9Tqt6BvbOe6q6sro1yCygiDW4dN3r1OvmvQM,3375
100
- sourcecode/telemetry/config.py,sha256=_MfMevIic1NTc8IRmCzQs96D8KPBLOWZ5cdhWrnHuwI,2639
101
- sourcecode/telemetry/consent.py,sha256=wLMvGNJeSSyZoNkQXpoUioY6mMv4Qdvuw7S9jAEWnII,2237
99
+ sourcecode/telemetry/__init__.py,sha256=6wsJnXsgsL_BtMK4hr5Ae1GToHeWej53F4o_-Tc23MQ,3406
100
+ sourcecode/telemetry/config.py,sha256=u_zctgmA1pVT3Ai5jm-pdLY_5kJTRg4Xq2bvIbGBQE4,3727
101
+ sourcecode/telemetry/consent.py,sha256=H5z2Wu63pZqbaKucRPoJQJ0zCo4cke9ZlBrJC-MaWTE,2201
102
102
  sourcecode/telemetry/events.py,sha256=LtzYfaX9Ilckj5PTvAcTpDa9mLqDsYPDUiDkRa58piY,2580
103
103
  sourcecode/telemetry/filters.py,sha256=NHa5T-6DaZduQPFuC34jOqHWQgSizM-Ygq8aZ4j19ng,5834
104
104
  sourcecode/telemetry/transport.py,sha256=4gGHsq0WeY9VywEZXA3vUxykfiYnw9uuqfjAAec7F8o,1681
105
- sourcecode-1.59.0.dist-info/METADATA,sha256=Tl_qHFWT-yXKwDto4VaZ_H9xnvBvabtL_oCosI4fn-0,38831
106
- sourcecode-1.59.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
107
- sourcecode-1.59.0.dist-info/entry_points.txt,sha256=ex3F9rmbXeyDIoFQHtkEqTsKSaJow8F0LrVu8XfIktQ,57
108
- sourcecode-1.59.0.dist-info/licenses/LICENSE,sha256=7DdHrU9Z_3e7dSvq4ISijZNjnuHo5NIHNiHDouMQ9JU,10491
109
- sourcecode-1.59.0.dist-info/RECORD,,
105
+ sourcecode-1.60.0.dist-info/METADATA,sha256=13oyunu_mO7yr8DwHg2AwrNQ4tW0tHWydwzUEoOBnss,38941
106
+ sourcecode-1.60.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
107
+ sourcecode-1.60.0.dist-info/entry_points.txt,sha256=ex3F9rmbXeyDIoFQHtkEqTsKSaJow8F0LrVu8XfIktQ,57
108
+ sourcecode-1.60.0.dist-info/licenses/LICENSE,sha256=7DdHrU9Z_3e7dSvq4ISijZNjnuHo5NIHNiHDouMQ9JU,10491
109
+ sourcecode-1.60.0.dist-info/RECORD,,