codemind-sh 0.1.8__tar.gz → 0.2.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.
Files changed (77) hide show
  1. codemind_sh-0.2.0/LICENSE +21 -0
  2. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/PKG-INFO +7 -7
  3. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/README.md +5 -5
  4. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/__init__.py +1 -1
  5. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/cli.py +172 -146
  6. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/graph/builder.py +71 -0
  7. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/license/client.py +29 -46
  8. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/license/keygen.py +15 -12
  9. codemind_sh-0.2.0/codemind/license/license.py +96 -0
  10. codemind_sh-0.2.0/codemind/license/pricing.py +103 -0
  11. codemind_sh-0.2.0/codemind/license/state.py +48 -0
  12. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/pyproject.toml +2 -2
  13. codemind_sh-0.1.8/LICENSE +0 -91
  14. codemind_sh-0.1.8/codemind/license/enforcer.py +0 -102
  15. codemind_sh-0.1.8/codemind/license/license.py +0 -164
  16. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/__main__.py +0 -0
  17. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/ai/__init__.py +0 -0
  18. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/ai/enricher.py +0 -0
  19. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/ai/pro_features.py +0 -0
  20. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/ai/stack_learner.py +0 -0
  21. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/analyzer/__init__.py +0 -0
  22. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/analyzer/base.py +0 -0
  23. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/analyzer/dependency_analyzer.py +0 -0
  24. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/analyzer/java_analyzer.py +0 -0
  25. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/analyzer/typescript_analyzer.py +0 -0
  26. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/context/__init__.py +0 -0
  27. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/context/engine.py +0 -0
  28. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/core/__init__.py +0 -0
  29. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/core/config.py +0 -0
  30. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/core/constants.py +0 -0
  31. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/core/graph.py +0 -0
  32. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/core/project.py +0 -0
  33. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/git/__init__.py +0 -0
  34. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/graph/__init__.py +0 -0
  35. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/graph/query.py +0 -0
  36. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/graph/store.py +0 -0
  37. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/health/__init__.py +0 -0
  38. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/health/checker.py +0 -0
  39. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/health/dependency_check.py +0 -0
  40. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/health/pattern_check.py +0 -0
  41. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/health/test_coverage.py +0 -0
  42. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/knowledge/__init__.py +0 -0
  43. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/knowledge/architecture.py +0 -0
  44. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/knowledge/connection_builder.py +0 -0
  45. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/knowledge/connections.py +0 -0
  46. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/knowledge/generator.py +0 -0
  47. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/knowledge/index_builder.py +0 -0
  48. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/license/__init__.py +0 -0
  49. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/mcp/__init__.py +0 -0
  50. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/mcp/connect.py +0 -0
  51. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/mcp/decisions.py +0 -0
  52. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/mcp/server.py +0 -0
  53. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/mcp/tools.py +0 -0
  54. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/parser/__init__.py +0 -0
  55. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/parser/base.py +0 -0
  56. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/parser/gap_detector.py +0 -0
  57. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/parser/java_parser.py +0 -0
  58. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/parser/python_parser.py +0 -0
  59. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/parser/registry.py +0 -0
  60. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/parser/rule_cache.py +0 -0
  61. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/parser/typescript_parser.py +0 -0
  62. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/router/__init__.py +0 -0
  63. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/router/call_extractor.py +0 -0
  64. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/router/linker.py +0 -0
  65. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/router/route_extractor.py +0 -0
  66. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/scaffold/__init__.py +0 -0
  67. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/scaffold/generator.py +0 -0
  68. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/scaffold/pattern_extractor.py +0 -0
  69. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/scaffold/templates/java/controller.java.j2 +0 -0
  70. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/scaffold/templates/java/entity.java.j2 +0 -0
  71. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/scaffold/templates/java/repository.java.j2 +0 -0
  72. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/scaffold/templates/java/service.java.j2 +0 -0
  73. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/scaffold/templates/java/test.java.j2 +0 -0
  74. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/scaffold/templates/typescript/service.ts.j2 +0 -0
  75. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/tasks/__init__.py +0 -0
  76. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/watcher/__init__.py +0 -0
  77. {codemind_sh-0.1.8 → codemind_sh-0.2.0}/codemind/watcher/handler.py +0 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 OnixSolutions (onixsolutions.net)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codemind-sh
3
- Version: 0.1.8
3
+ Version: 0.2.0
4
4
  Summary: Local-first knowledge graph for software projects. Gives AI tools structural facts about your codebase via 11 MCP tools.
5
5
  License: MIT
6
6
  License-File: LICENSE
7
7
  Keywords: ai,developer-tools,codebase,mcp,context,architecture
8
8
  Author: Mohammed
9
- Author-email: mohammed@onixsolutions.net
9
+ Author-email: support@onixsolutions.net
10
10
  Requires-Python: >=3.11,<4.0
11
11
  Classifier: Development Status :: 3 - Alpha
12
12
  Classifier: Environment :: Console
@@ -240,7 +240,7 @@ nothing. One `codemind review` (~$0.003) generates a report the whole team benef
240
240
 
241
241
  ```bash
242
242
  # Core
243
- codemind init # Initialize .codemind/ (1 project free)
243
+ codemind init # Initialize .codemind/ (free, unlimited projects)
244
244
  codemind scan # Parse codebase → graph.json + ARCHITECTURE.md + modules/
245
245
  codemind status # Graph stats overview
246
246
 
@@ -259,7 +259,7 @@ codemind query "" --connections KpiService # get_connections
259
259
  codemind query "" --impact ThresholdEvaluator # impact_analysis
260
260
  codemind query "" --pattern # get_pattern
261
261
 
262
- # Pro AI (requires ANTHROPIC_API_KEY)
262
+ # AI features (BYOK — requires ANTHROPIC_API_KEY)
263
263
  codemind review # Architectural review
264
264
  codemind brief # Onboarding brief
265
265
  codemind impact <component> --ai # Impact + AI risk assessment
@@ -330,9 +330,9 @@ The optional BYOK AI enricher (gap-filling injection edges) sends only small str
330
330
 
331
331
  ## License
332
332
 
333
- Business Source License 1.1 (BSL) — source visible, not for commercial redistribution.
334
- Converts to MIT after 4 years.
335
- Personal and evaluation use permitted.
333
+ **Free & open source (MIT).** No paywall, no license keys, no telemetry. Use it on
334
+ unlimited projects. The optional AI features are BYOK — bring your own
335
+ `ANTHROPIC_API_KEY`; everything else runs entirely offline and free.
336
336
 
337
337
  Built by [OnixSolutions](https://onixsolutions.net)
338
338
 
@@ -196,7 +196,7 @@ nothing. One `codemind review` (~$0.003) generates a report the whole team benef
196
196
 
197
197
  ```bash
198
198
  # Core
199
- codemind init # Initialize .codemind/ (1 project free)
199
+ codemind init # Initialize .codemind/ (free, unlimited projects)
200
200
  codemind scan # Parse codebase → graph.json + ARCHITECTURE.md + modules/
201
201
  codemind status # Graph stats overview
202
202
 
@@ -215,7 +215,7 @@ codemind query "" --connections KpiService # get_connections
215
215
  codemind query "" --impact ThresholdEvaluator # impact_analysis
216
216
  codemind query "" --pattern # get_pattern
217
217
 
218
- # Pro AI (requires ANTHROPIC_API_KEY)
218
+ # AI features (BYOK — requires ANTHROPIC_API_KEY)
219
219
  codemind review # Architectural review
220
220
  codemind brief # Onboarding brief
221
221
  codemind impact <component> --ai # Impact + AI risk assessment
@@ -286,8 +286,8 @@ The optional BYOK AI enricher (gap-filling injection edges) sends only small str
286
286
 
287
287
  ## License
288
288
 
289
- Business Source License 1.1 (BSL) — source visible, not for commercial redistribution.
290
- Converts to MIT after 4 years.
291
- Personal and evaluation use permitted.
289
+ **Free & open source (MIT).** No paywall, no license keys, no telemetry. Use it on
290
+ unlimited projects. The optional AI features are BYOK — bring your own
291
+ `ANTHROPIC_API_KEY`; everything else runs entirely offline and free.
292
292
 
293
293
  Built by [OnixSolutions](https://onixsolutions.net)
@@ -1,4 +1,4 @@
1
1
  """CodeMind — Local-first intelligence layer for software projects."""
2
2
 
3
- __version__ = "0.1.8"
3
+ __version__ = "0.2.0"
4
4
  __app_name__ = "codemind"
@@ -17,8 +17,14 @@ from codemind.core.config import CodemindConfig, StructureConfig, TechStackConfi
17
17
  from codemind.core.project import CodemindProject
18
18
  from codemind.core.constants import CODEMIND_DIR
19
19
  from codemind.license.license import LicenseManager
20
- from codemind.license.enforcer import LicenseEnforcer
21
- from codemind.license.client import LicenseClient, LicenseLimitReached
20
+ from codemind.license.client import LicenseClient
21
+ from codemind.license.pricing import (
22
+ GITHUB_REPO_URL,
23
+ donation_info,
24
+ get_pricing,
25
+ refresh_pricing_cache,
26
+ )
27
+ from codemind.license.state import get_flag, set_flag
22
28
 
23
29
  # ── App Setup ──
24
30
  app = typer.Typer(
@@ -32,6 +38,72 @@ console = Console()
32
38
  _err = Console(stderr=True)
33
39
 
34
40
 
41
+ def _ask_optional_email(prompt_label: str) -> str:
42
+ """Prompt for an optional email. Enter skips; light validation if entered."""
43
+ while True:
44
+ entered = Prompt.ask(prompt_label, default="").strip().lower()
45
+ if not entered:
46
+ return ""
47
+ if "@" in entered and "." in entered.split("@")[-1]:
48
+ return entered
49
+ console.print(" [yellow]⚠[/yellow] That doesn't look like an email — "
50
+ "try again or press Enter to skip.")
51
+
52
+
53
+ def _render_support_line(pricing: dict) -> str:
54
+ """One warm line from the pricing config — donation today, freemium-aware.
55
+
56
+ Renders whatever the server config says: donation mode shows the donation
57
+ URL; a future ``mode: freemium`` with ``paid.enabled`` shows the paid
58
+ offer instead — no CLI release needed to flip.
59
+ """
60
+ paid = pricing.get("paid") or {}
61
+ if pricing.get("mode") == "freemium" and paid.get("enabled"):
62
+ price = paid.get("price_display") or ""
63
+ checkout = paid.get("checkout_url") or ""
64
+ parts = [p for p in (price, checkout) if p]
65
+ if parts:
66
+ return (
67
+ f" [red]♥[/red] CodeMind Pro: [cyan]{' · '.join(parts)}[/cyan]"
68
+ )
69
+ donation = pricing.get("donation") or {}
70
+ if donation.get("enabled") is False:
71
+ return ""
72
+ url, _ = donation_info(pricing)
73
+ return f" [red]♥[/red] CodeMind is free & open source. If it helps: [cyan]{url}[/cyan]"
74
+
75
+
76
+ def _maybe_backfill_email(lic_state, lic_mgr: LicenseManager) -> None:
77
+ """Ask once — ever — for an optional recovery email during scan.
78
+
79
+ Legacy installs may have a key but no email. We ask a single time, only
80
+ on an interactive terminal (never blocks pipes/CI), and persist an
81
+ ``email_prompted`` flag in ~/.codemind/state.json so a skip is final.
82
+ """
83
+ import sys as _sys
84
+
85
+ if not lic_state.license_key or lic_state.email:
86
+ return
87
+ if not _sys.stdin.isatty():
88
+ return
89
+ if get_flag("email_prompted"):
90
+ return
91
+
92
+ console.print()
93
+ console.print(
94
+ " [dim]◆ Optional: add an email to recover your install key if you "
95
+ "reinstall. Press Enter to skip.[/dim]"
96
+ )
97
+ email = _ask_optional_email(" [bold]Email address[/bold] [dim](optional)[/dim]")
98
+ set_flag("email_prompted")
99
+ if email:
100
+ LicenseClient().register_email(lic_state.license_key, email)
101
+ lic_state.email = email
102
+ lic_mgr.save(lic_state)
103
+ console.print(f" [green]✓[/green] Email registered: [dim]{email}[/dim]")
104
+ console.print()
105
+
106
+
35
107
  def version_callback(value: bool) -> None:
36
108
  """Print version and exit."""
37
109
  if value:
@@ -64,56 +136,45 @@ def init(
64
136
  """
65
137
  project_root = (path or Path.cwd()).resolve()
66
138
 
67
- # ── License check ──────────────────────────────────────────────────────────
139
+ # ── Server-driven pricing config — best-effort refresh, never blocks ──────
140
+ import threading as _threading
141
+ _pricing_thread = _threading.Thread(target=refresh_pricing_cache, daemon=True)
142
+ _pricing_thread.start()
143
+
144
+ # ── Install identity (free — never blocks) ─────────────────────────────────
68
145
  _lic_mgr = LicenseManager()
69
146
  if not _lic_mgr.exists():
70
- # First run — collect email (required), then generate trial key from server
71
- console.print()
72
- console.print(" [cyan]◆[/cyan] First run — activating your free CodeMind license.")
147
+ # First run — optional email, then create an anonymous install identity.
148
+ # Server registration is best-effort; offline works out of the box.
73
149
  console.print()
74
- # Email is required — it's the only way to recover the license key
75
- console.print(" [dim]Your email is stored on the license server to allow key recovery.[/dim]")
76
- console.print(" [dim]We don't spam. You'll only hear from us about your license.[/dim]")
150
+ console.print(" [cyan]◆[/cyan] First run — setting up your free CodeMind install.")
77
151
  console.print()
78
152
  _email = ""
79
- while not _email or "@" not in _email or "." not in _email.split("@")[-1]:
80
- _email = Prompt.ask(" [bold]Email address[/bold]").strip().lower()
81
- if not _email or "@" not in _email or "." not in _email.split("@")[-1]:
82
- console.print(" [red]✗[/red] Please enter a valid email address.")
83
- try:
84
- trial_state = LicenseClient().generate_trial(email=_email)
85
- except RuntimeError as e:
86
- console.print()
87
- console.print(f" [red]✗[/red] {e}")
153
+ if not non_interactive:
154
+ console.print(
155
+ " [dim]Email is optional — used only to recover your install key. "
156
+ "Press Enter to skip.[/dim]"
157
+ )
88
158
  console.print()
89
- raise typer.Exit(1)
159
+ _email = _ask_optional_email(" [bold]Email address[/bold] [dim](optional)[/dim]")
160
+ set_flag("email_prompted") # asked once — scan never re-asks
161
+ trial_state = LicenseClient().generate_trial(email=_email)
90
162
  trial_state.email = _email
91
163
  _lic_mgr.save(trial_state)
92
164
  console.print()
93
165
  console.print(
94
- f" [green]✓[/green] License activated: [bold]{trial_state.license_key}[/bold]"
166
+ f" [green]✓[/green] Install key: [bold]{trial_state.license_key}[/bold]"
95
167
  )
96
- console.print(
97
- f" [green]✓[/green] Email registered: [dim]{_email}[/dim]"
98
- )
99
- console.print(" [dim]Free plan: 1 project, no credit card required.[/dim]")
168
+ if _email:
169
+ console.print(f" [green]✓[/green] Email registered: [dim]{_email}[/dim]")
170
+ console.print(" [dim]CodeMind is free. No account, no credit card, works offline.[/dim]")
100
171
 
101
172
  _lic_state = _lic_mgr.load()
102
173
 
103
174
  # Load project_id if project already exists (reinit case)
104
175
  _existing_project = CodemindProject(project_root)
105
176
  _project_id = _existing_project.config.project_id if _existing_project.is_initialized else ""
106
-
107
- _check = LicenseEnforcer().check_init(_lic_state, _project_id)
108
- if not _check.allowed:
109
- console.print()
110
- console.print(f" [red]✗[/red] {_check.reason}")
111
- console.print()
112
- raise typer.Exit(1)
113
- if _check.warning:
114
- console.print()
115
- console.print(f" [yellow]⚠[/yellow] {_check.warning}")
116
- # ── End license check ──────────────────────────────────────────────────────
177
+ # ── End install identity ───────────────────────────────────────────────────
117
178
 
118
179
  # Check if already initialized
119
180
  if (project_root / CODEMIND_DIR).exists():
@@ -203,65 +264,18 @@ def init(
203
264
  config.project_id = _project_id
204
265
  project.initialize(config)
205
266
 
206
- # ── Server validation — authoritative project limit check ──────────────────
207
- # The server is the source of truth. Local license.yml can be edited by
208
- # anyone — only the server DB count is tamper-proof.
267
+ # ── Best-effort server registration (never blocks, never rolls back) ───────
209
268
  if project.config.project_id and _lic_state.license_key:
210
- _is_class_a = _lic_state.is_class_a(project.config.project_id)
211
269
  try:
212
270
  updated = LicenseClient().validate(
213
271
  _lic_state.license_key, project.config.project_id
214
272
  )
215
273
  if updated:
274
+ if _lic_state.email and not updated.email:
275
+ updated.email = _lic_state.email
216
276
  _lic_mgr.save(updated)
217
- _lic_mgr.add_activated_project(project.config.project_id)
218
- elif not _is_class_a:
219
- # Server unreachable AND this is a new (unregistered) project —
220
- # roll back to prevent unlimited offline bypass
221
- import shutil
222
- _codemind_dir = project_root / CODEMIND_DIR
223
- if _codemind_dir.exists():
224
- shutil.rmtree(_codemind_dir)
225
- console.print()
226
- console.print(
227
- " [red]✗[/red] Could not reach the license server to activate this project."
228
- )
229
- console.print(
230
- " [dim]Please check your internet connection and run "
231
- "[bold]codemind init[/bold] again.[/dim]"
232
- )
233
- console.print()
234
- raise typer.Exit(1)
235
- else:
236
- # Class A project (already registered) — offline reinit is fine
237
- _lic_mgr.add_activated_project(project.config.project_id)
238
- except LicenseLimitReached as e:
239
- if _is_class_a:
240
- # Class A project — was activated before, keep it working locally.
241
- # Server 402 means they hit the limit for NEW projects, not existing ones.
242
- _lic_mgr.add_activated_project(project.config.project_id)
243
- console.print()
244
- console.print(
245
- " [yellow]⚠[/yellow] This project was already activated on your license "
246
- "and will keep working."
247
- )
248
- console.print(
249
- " [dim]Upgrade at [cyan]codemind.sh/upgrade[/cyan] to register "
250
- "additional projects.[/dim]"
251
- )
252
- else:
253
- # New project hitting the server limit — rollback
254
- import shutil
255
- _codemind_dir = project_root / CODEMIND_DIR
256
- if _codemind_dir.exists():
257
- shutil.rmtree(_codemind_dir)
258
- console.print()
259
- console.print(f" [red]✗[/red] {e.detail}")
260
- console.print(
261
- " Upgrade at [cyan]codemind.sh/upgrade[/cyan] to add unlimited projects."
262
- )
263
- console.print()
264
- raise typer.Exit(1)
277
+ except Exception:
278
+ pass # offline is a first-class citizen — nothing to do
265
279
 
266
280
  # ── Show result ──
267
281
  console.print()
@@ -301,6 +315,18 @@ def init(
301
315
  console.print(" [green]2.[/green] Run [bold cyan]codemind serve[/bold cyan] to start MCP for Claude Code / Cursor")
302
316
  console.print()
303
317
 
318
+ # ── One-time donation note — shown once ever, across all projects ─────────
319
+ if not get_flag("donation_note_shown"):
320
+ _pricing_thread.join(timeout=2.0) # give the fetch a moment; cache/default otherwise
321
+ _support_line = _render_support_line(get_pricing())
322
+ if _support_line:
323
+ console.print(_support_line)
324
+ console.print(
325
+ " [dim](run 'codemind support' anytime — this won't be shown again)[/dim]"
326
+ )
327
+ console.print()
328
+ set_flag("donation_note_shown")
329
+
304
330
 
305
331
  # ══════════════════════════════════════
306
332
  # STATUS COMMAND
@@ -404,6 +430,54 @@ def status(
404
430
  )
405
431
 
406
432
  console.print()
433
+ console.print(" [dim]♥ Free & open source · run 'codemind support'[/dim]")
434
+ console.print()
435
+
436
+
437
+ # ══════════════════════════════════════
438
+ # SUPPORT COMMAND
439
+ # ══════════════════════════════════════
440
+ @app.command()
441
+ def support() -> None:
442
+ """Support CodeMind — it's free & open source, and donations keep it that way."""
443
+ pricing = get_pricing() # cache → bundled default; never needs network
444
+ url, message = donation_info(pricing)
445
+
446
+ lines = [
447
+ "[bold]Thank you for using CodeMind![/bold]",
448
+ "",
449
+ f"[dim]{message}[/dim]",
450
+ "",
451
+ f" [red]♥[/red] Donate: [cyan]{url}[/cyan]",
452
+ f" [yellow]★[/yellow] GitHub: [cyan]{GITHUB_REPO_URL}[/cyan]",
453
+ ]
454
+
455
+ # Future-proof: if the server ever flips to freemium, render the paid offer
456
+ # from the same config — no CLI release needed.
457
+ paid = pricing.get("paid") or {}
458
+ if pricing.get("mode") == "freemium" and paid.get("enabled"):
459
+ price = paid.get("price_display") or ""
460
+ checkout = paid.get("checkout_url") or ""
461
+ offer = " · ".join(p for p in (price, checkout) if p)
462
+ if offer:
463
+ lines.append(f" [green]◆[/green] Pro: [cyan]{offer}[/cyan]")
464
+
465
+ lines += [
466
+ "",
467
+ "[dim]A star on GitHub helps other developers find CodeMind — "
468
+ "that's worth as much as a coffee.[/dim]",
469
+ ]
470
+
471
+ console.print()
472
+ console.print(
473
+ Panel(
474
+ "\n".join(lines),
475
+ title="[red]♥[/red] Support CodeMind",
476
+ border_style="cyan",
477
+ padding=(1, 2),
478
+ )
479
+ )
480
+ console.print()
407
481
 
408
482
 
409
483
  # ══════════════════════════════════════
@@ -428,56 +502,16 @@ def scan(
428
502
 
429
503
  project = _get_project(path)
430
504
 
431
- # ── License check ──────────────────────────────────────────────────────────
505
+ # ── Install identity — free, never blocks scan ──────────────────────────────
432
506
  _lic_mgr = LicenseManager()
433
507
  _lic_state = _lic_mgr.load()
434
508
  _project_id = project.config.project_id
435
- _graph_exists = project.graph_path.exists()
436
-
437
- # Legacy projects (pre-Phase 7) have no project_id — treat as Class A
438
- if not _project_id and _graph_exists:
439
- _project_id = "__legacy__"
440
- if "__legacy__" not in _lic_state.activated_projects:
441
- _lic_mgr.add_activated_project("__legacy__")
442
- _lic_state = _lic_mgr.load()
443
-
444
- _scan_check = LicenseEnforcer().check_scan(_lic_state, _project_id, _graph_exists)
445
- if not _scan_check.allowed:
446
- console.print()
447
- console.print(f" [red]✗[/red] {_scan_check.reason}")
448
- console.print()
449
- raise typer.Exit(1)
450
- if _scan_check.warning:
451
- console.print()
452
- console.print(f" [yellow]⚠[/yellow] {_scan_check.warning}")
453
-
454
- _ai_ok = LicenseEnforcer().ai_allowed(_lic_state)
455
509
 
456
- # ── Email enforcement — required for license recovery and account management ─
457
- if _lic_state.license_key and not _lic_state.email:
458
- console.print()
459
- console.print(
460
- " [yellow]◆[/yellow] Your license has no email address on file."
461
- )
462
- console.print(
463
- " [dim]Email is required to recover your license key if you reinstall.[/dim]"
464
- )
465
- console.print()
466
- _scan_email = ""
467
- while not _scan_email or "@" not in _scan_email or "." not in _scan_email.split("@")[-1]:
468
- _scan_email = Prompt.ask(" [bold]Email address[/bold]").strip().lower()
469
- if not _scan_email or "@" not in _scan_email or "." not in _scan_email.split("@")[-1]:
470
- console.print(" [red]✗[/red] Please enter a valid email address.")
471
- LicenseClient().register_email(_lic_state.license_key, _scan_email)
472
- _lic_state.email = _scan_email
473
- _lic_mgr.save(_lic_state)
474
- console.print(f" [green]✓[/green] Email registered: [dim]{_scan_email}[/dim]")
475
- console.print()
510
+ # Optional email backfill (legacy installs) — asked once ever, never blocks
511
+ _maybe_backfill_email(_lic_state, _lic_mgr)
476
512
 
477
- # ── Background registration — silently register offline/legacy keys ────────
478
- # Users who inited before v0.1.5 (or offline) may have unregistered keys.
479
- # Fire-and-forget: success = they appear in dashboard; failure = no impact.
480
- if _lic_state.license_key and _project_id and _project_id != "__legacy__":
513
+ # ── Background registration — best-effort, fire-and-forget ─────────────────
514
+ if _lic_state.license_key and _project_id:
481
515
  import threading
482
516
  _scan_email_for_bg = _lic_state.email
483
517
  def _bg_register() -> None:
@@ -487,14 +521,11 @@ def scan(
487
521
  if _scan_email_for_bg and not updated.email:
488
522
  updated.email = _scan_email_for_bg
489
523
  LicenseManager().save(updated)
490
- LicenseManager().add_activated_project(_project_id)
491
- # If email is now on file but not on server, push it
492
- if _scan_email_for_bg:
493
- LicenseClient().register_email(_lic_state.license_key, _scan_email_for_bg)
524
+ refresh_pricing_cache() # opportunistic — keeps pricing.json fresh
494
525
  except Exception:
495
526
  pass
496
527
  threading.Thread(target=_bg_register, daemon=True).start()
497
- # ── End license check ──────────────────────────────────────────────────────
528
+ # ── End install identity ────────────────────────────────────────────────────
498
529
 
499
530
  console.print()
500
531
  console.print(
@@ -524,15 +555,10 @@ def scan(
524
555
  codemind_dir=project.codemind_dir,
525
556
  project_name=project.config.project_name or project.root.name,
526
557
  progress_callback=_scan_progress,
527
- ai_enrich=_ai_ok,
558
+ ai_enrich=None, # auto-detect: BYOK via ANTHROPIC_API_KEY
528
559
  )
529
560
  progress.remove_task(t)
530
561
 
531
- # Ensure project is registered as Class A after every successful scan
532
- _real_id = project.config.project_id
533
- if _real_id:
534
- _lic_mgr.add_activated_project(_real_id)
535
-
536
562
  # ── Cross-layer routing enrichment (fullstack projects) ──────────────────
537
563
  if project.config.structure.project_type == "fullstack" or _has_fullstack_signals(graph):
538
564
  from codemind.router.route_extractor import enrich_graph_with_routes
@@ -1384,7 +1410,7 @@ def review(
1384
1410
  strengths, risks, recommendations, and key metrics.
1385
1411
  Output is written to ``.codemind/REVIEW.md`` and cached.
1386
1412
 
1387
- Requires ``ANTHROPIC_API_KEY`` (or Pro license).
1413
+ Requires ``ANTHROPIC_API_KEY`` (BYOK — you pay Anthropic directly).
1388
1414
 
1389
1415
  Example::
1390
1416
 
@@ -1439,7 +1465,7 @@ def brief(
1439
1465
  the 3 domains to understand first, key patterns, and a glossary.
1440
1466
  Output is written to ``.codemind/BRIEF.md`` and cached.
1441
1467
 
1442
- Requires ``ANTHROPIC_API_KEY`` (or Pro license).
1468
+ Requires ``ANTHROPIC_API_KEY`` (BYOK — you pay Anthropic directly).
1443
1469
 
1444
1470
  Example::
1445
1471
 
@@ -1494,7 +1520,7 @@ def impact(
1494
1520
  Without ``--ai``: runs the structural BFS (same as ``codemind query --impact``).
1495
1521
  With ``--ai``: adds Claude's risk assessment on top of the structural result.
1496
1522
 
1497
- Requires ``ANTHROPIC_API_KEY`` for ``--ai`` (or Pro license).
1523
+ Requires ``ANTHROPIC_API_KEY`` for ``--ai`` (BYOK — you pay Anthropic directly).
1498
1524
 
1499
1525
  Examples::
1500
1526
 
@@ -243,6 +243,12 @@ class GraphBuilder:
243
243
  meta=edge.meta,
244
244
  ))
245
245
 
246
+ # BUG-1: regenerate cross-layer routing after the incremental rebuild.
247
+ # `remove_file` above dropped the changed node's cross_layer edges and
248
+ # its router-written metadata (routes / api_calls), and the parser does
249
+ # NOT recreate them. Without this the graph decays after the first scan.
250
+ _reenrich_cross_layer(graph, project_root)
251
+
246
252
  self._store.save(graph, codemind_dir)
247
253
  return graph
248
254
 
@@ -356,6 +362,71 @@ def _count_gaps(graph: CodeGraph) -> int:
356
362
  return 0
357
363
 
358
364
 
365
+ def _looks_fullstack(graph: CodeGraph) -> bool:
366
+ """Cheap check: could this graph contain cross-layer (frontend↔backend) edges?
367
+
368
+ Mirrors ``cli._has_fullstack_signals`` so single-stack projects pay nothing
369
+ for cross-layer re-enrichment on every incremental save.
370
+ """
371
+ langs = {n.language for n in graph.nodes.values()}
372
+ # Classic Spring/Java backend + Angular/React (TypeScript) frontend
373
+ if "java" in langs and "typescript" in langs:
374
+ return True
375
+ # TypeScript monorepo: NestJS backend (class/controller) + frontend component
376
+ if "typescript" in langs:
377
+ ts_types = {n.type for n in graph.nodes.values() if n.language == "typescript"}
378
+ if "component" in ts_types and (ts_types & {"class", "controller"}):
379
+ return True
380
+ return False
381
+
382
+
383
+ def _reenrich_cross_layer(graph: CodeGraph, project_root: Path) -> None:
384
+ """Regenerate cross-layer routing after an incremental ``rebuild_file``.
385
+
386
+ BUG-1 fix. Cross-layer routing (frontend HTTP call → backend route
387
+ ``cross_layer`` edges, powering ``trace_request`` and cross-layer
388
+ ``get_connections``) previously ran ONLY during a full ``codemind scan``.
389
+ The incremental path — ``rebuild_file``, invoked by the watcher on every
390
+ save — re-parsed the changed file but never re-ran the router. Because
391
+ ``CodeGraph.remove_file`` deletes the changed node together with its
392
+ ``cross_layer`` edges and its router-written ``metadata["routes"]`` /
393
+ ``["api_calls"]`` (which the parser does NOT recreate), editing any
394
+ frontend/backend file silently dropped its cross-layer links until the
395
+ next full scan.
396
+
397
+ Approach — graph-wide re-link. The linker matches every frontend call
398
+ against the FULL backend route table (and vice-versa), so a change on one
399
+ layer can affect links on the opposite layer. We therefore re-run the whole
400
+ enrichment over the in-memory graph. Route / api_call metadata is recomputed
401
+ cheaply from each node's source, and the linkers dedupe on (source, target),
402
+ so re-running is idempotent and never double-adds.
403
+
404
+ PERF (follow-up): this is graph-wide on every save. A tightly-scoped
405
+ "neighbourhood only" re-link is deferred — it ties into the separate P2
406
+ storage/indexing work. Correctness first.
407
+ """
408
+ # Skip single-stack projects: they can never have cross-layer edges, so the
409
+ # (file-reading) enrichment would be pure overhead. Also keeps this a no-op
410
+ # during a full scan, which handles its own enrichment and never calls
411
+ # rebuild_file.
412
+ if not _looks_fullstack(graph):
413
+ return
414
+
415
+ try:
416
+ from codemind.router.route_extractor import enrich_graph_with_routes
417
+ from codemind.router.call_extractor import enrich_graph_with_api_calls
418
+ from codemind.router.linker import create_cross_layer_edges, route_first_link
419
+
420
+ enrich_graph_with_routes(graph, project_root)
421
+ enrich_graph_with_api_calls(graph, project_root)
422
+ create_cross_layer_edges(graph)
423
+ route_first_link(graph, project_root)
424
+ except Exception:
425
+ # Never let router enrichment crash an incremental rebuild — the parser
426
+ # edges are already applied; cross-layer links catch up on next save/scan.
427
+ pass
428
+
429
+
359
430
  def _detect_frameworks(project_root: Path) -> list[str]:
360
431
  """Heuristic framework detection from build files."""
361
432
  frameworks: set[str] = set()