htmlgraph 0.21.0__py3-none-any.whl → 0.22.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.
@@ -0,0 +1,161 @@
1
+ """
2
+ Version checking and interactive upgrade workflows.
3
+ """
4
+
5
+ from pathlib import Path
6
+ from typing import TYPE_CHECKING
7
+
8
+ from htmlgraph.docs.docs_version import get_current_doc_version, is_compatible
9
+ from htmlgraph.docs.metadata import DocsMetadata
10
+ from htmlgraph.docs.migrations import get_migration
11
+
12
+ if TYPE_CHECKING:
13
+ from htmlgraph.docs.migrations import MigrationScript
14
+
15
+
16
+ def check_docs_version(htmlgraph_dir: Path) -> tuple[bool, str | None]:
17
+ """Check if docs version is compatible.
18
+
19
+ Args:
20
+ htmlgraph_dir: Path to .htmlgraph directory
21
+
22
+ Returns:
23
+ Tuple of (is_compatible, message)
24
+ - is_compatible: True if compatible
25
+ - message: Optional warning/error message
26
+ """
27
+ metadata = DocsMetadata.load(htmlgraph_dir)
28
+ current_version = get_current_doc_version()
29
+
30
+ if metadata.schema_version == current_version:
31
+ return True, None
32
+
33
+ if is_compatible(metadata.schema_version, current_version):
34
+ return (
35
+ True,
36
+ f"⚠️ Docs version {metadata.schema_version} is supported but outdated (current: {current_version})",
37
+ )
38
+
39
+ return (
40
+ False,
41
+ f"❌ Docs version {metadata.schema_version} is incompatible with package (requires: {current_version})",
42
+ )
43
+
44
+
45
+ def upgrade_docs_interactive(htmlgraph_dir: Path) -> None:
46
+ """Interactive upgrade workflow with user prompts.
47
+
48
+ Args:
49
+ htmlgraph_dir: Path to .htmlgraph directory
50
+ """
51
+ metadata = DocsMetadata.load(htmlgraph_dir)
52
+ current_version = get_current_doc_version()
53
+
54
+ if metadata.schema_version == current_version:
55
+ print("✅ Docs are up to date")
56
+ return
57
+
58
+ # Get migration script
59
+ migration = get_migration(metadata.schema_version, current_version)
60
+ if not migration:
61
+ print(
62
+ f"❌ No migration available from v{metadata.schema_version} to v{current_version}"
63
+ )
64
+ return
65
+
66
+ # Show user their options
67
+ print(
68
+ f"""
69
+ 📋 Documentation Upgrade Available
70
+ Current: v{metadata.schema_version}
71
+ Target: v{current_version}
72
+
73
+ Options:
74
+ 1. Auto-migrate (preserves customizations)
75
+ 2. Side-by-side (test before committing)
76
+ 3. Manual migration (view diff first)
77
+ 4. Skip (stay on v{metadata.schema_version})
78
+ """
79
+ )
80
+
81
+ choice = input("Choose option (1-4): ").strip()
82
+
83
+ if choice == "1":
84
+ _auto_migrate(htmlgraph_dir, migration)
85
+ elif choice == "2":
86
+ _side_by_side_migrate(htmlgraph_dir, migration)
87
+ elif choice == "3":
88
+ _show_diff_for_manual(htmlgraph_dir, migration)
89
+ else:
90
+ print("⏭️ Skipping migration")
91
+
92
+
93
+ def _auto_migrate(htmlgraph_dir: Path, migration: "MigrationScript") -> None: # type: ignore[name-defined]
94
+ """Automatically migrate with backup.
95
+
96
+ Args:
97
+ htmlgraph_dir: Path to .htmlgraph directory
98
+ migration: MigrationScript instance
99
+ """
100
+ backup_dir = htmlgraph_dir / ".docs-backups"
101
+ backup_dir.mkdir(exist_ok=True)
102
+
103
+ print("🚀 Starting auto-migration...")
104
+ success = migration.migrate(htmlgraph_dir, backup_dir)
105
+
106
+ if success:
107
+ print("✅ Migration complete!")
108
+ print(f"📦 Backup saved to {backup_dir}")
109
+ else:
110
+ print("❌ Migration failed. Docs unchanged.")
111
+
112
+
113
+ def _side_by_side_migrate(htmlgraph_dir: Path, migration: "MigrationScript") -> None: # type: ignore[name-defined]
114
+ """Create side-by-side versions for testing.
115
+
116
+ Args:
117
+ htmlgraph_dir: Path to .htmlgraph directory
118
+ migration: MigrationScript instance
119
+ """
120
+ print("📋 Creating side-by-side versions...")
121
+ print("⚠️ Side-by-side migration not yet implemented")
122
+ print(" Use option 1 (auto-migrate) or 3 (manual) instead")
123
+
124
+
125
+ def _show_diff_for_manual(htmlgraph_dir: Path, migration: "MigrationScript") -> None: # type: ignore[name-defined]
126
+ """Show diff preview for manual migration.
127
+
128
+ Args:
129
+ htmlgraph_dir: Path to .htmlgraph directory
130
+ migration: MigrationScript instance
131
+ """
132
+ print("📊 Showing migration preview...")
133
+ print("⚠️ Diff preview not yet implemented")
134
+ print(" Use option 1 (auto-migrate) instead")
135
+
136
+
137
+ def check_version_on_init(htmlgraph_dir: Path, auto_upgrade: bool = False) -> bool:
138
+ """Check version compatibility on SDK initialization.
139
+
140
+ Args:
141
+ htmlgraph_dir: Path to .htmlgraph directory
142
+ auto_upgrade: If True, automatically upgrade if safe
143
+
144
+ Returns:
145
+ True if compatible or upgraded successfully
146
+ """
147
+ compatible, message = check_docs_version(htmlgraph_dir)
148
+
149
+ if compatible and message:
150
+ # Compatible but outdated
151
+ print(message)
152
+ if auto_upgrade:
153
+ upgrade_docs_interactive(htmlgraph_dir)
154
+ return True
155
+
156
+ if not compatible:
157
+ print(message)
158
+ print("\nRun `uv run htmlgraph docs upgrade` to migrate.")
159
+ return False
160
+
161
+ return True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: htmlgraph
3
- Version: 0.21.0
3
+ Version: 0.22.0
4
4
  Summary: HTML is All You Need - Graph database on web standards
5
5
  Project-URL: Homepage, https://github.com/Shakes-tzd/htmlgraph
6
6
  Project-URL: Documentation, https://github.com/Shakes-tzd/htmlgraph#readme
@@ -1,10 +1,10 @@
1
- htmlgraph/__init__.py,sha256=AbgvM2vQ2nTI1DHlLsxmhhXZgrxmLxgwr5stbc25ZSc,4979
1
+ htmlgraph/__init__.py,sha256=NwNZ7Guk6B_uFRH7q8QwxYLn3opbpc3SQ89r3QPDoVQ,4979
2
2
  htmlgraph/agent_detection.py,sha256=PAYo7rU3N_y1cGRd7Dwjh5Wgu-QZ7ENblX_yOzU-gJ0,2749
3
3
  htmlgraph/agent_registry.py,sha256=Usa_35by7p5gtpvHO7K3AcGimnorw-FzgPVa3cWTQ58,9448
4
4
  htmlgraph/agents.py,sha256=Yvu6x1nOfrW2WhRTAHiCuSpvqoVJXx1Mkzd59kwEczw,33466
5
5
  htmlgraph/analytics_index.py,sha256=ba6Y4H_NNOCxI_Z4U7wSgBFFairf4IJT74WcM1PoZuI,30594
6
6
  htmlgraph/attribute_index.py,sha256=cBZUV4YfGnhh6lF59aYPCdNrRr1hK__BzSKCueSDUhQ,6593
7
- htmlgraph/cli.py,sha256=6CwzcFZ6tOlYCS1521gvFkwVw4qb9XSLvq-eqb2Mz8I,182068
7
+ htmlgraph/cli.py,sha256=cWmJLbUODzZxNI99TslGGLjE-u_PBHhayoRtuafS5RQ,190277
8
8
  htmlgraph/context_analytics.py,sha256=CaLu0o2uSr6rlBM5YeaFZe7grgsy7_Hx10qdXuNcdao,11344
9
9
  htmlgraph/converter.py,sha256=OfcydZcJqvr2jpMxvAD4wcq8o4NXC7w4X4QzdDiYq8k,22277
10
10
  htmlgraph/dashboard.html,sha256=rkZYjSnPbUuAm35QMpCNWemenYqQTdkkumCX2hhe8Dc,173537
@@ -82,6 +82,17 @@ htmlgraph/collections/pattern.py,sha256=FkEqF0eoMoluJxvpiZZ3OZnZNxMc24kzTL0Zmvyi
82
82
  htmlgraph/collections/phase.py,sha256=2GcgD-P-j61jgG4c0VhUmsOp1qjtrJLtRDNumHHDNZA,1359
83
83
  htmlgraph/collections/spike.py,sha256=Omazli2JM9RoYgseSAxKYeK4KC8mAwMCfUAF1XFml54,2963
84
84
  htmlgraph/collections/todo.py,sha256=SWOkolqCIvf7PCxCLuqPuNCpdDSTOc9KsuaXanWSEFY,15548
85
+ htmlgraph/docs/__init__.py,sha256=WlDS4y_DgpkoXQbJMucUjkCwyQs60t_QySI9m1CaMKU,2106
86
+ htmlgraph/docs/docs_version.py,sha256=4rXIhuhKv7VDGRlNtvWyB4zPboNGtcGfJjbf0yf1sI0,1475
87
+ htmlgraph/docs/metadata.py,sha256=sUlbIEqysXRma99a2KLSfJ-NqPYfz5p2pSj-s8wPblQ,2708
88
+ htmlgraph/docs/migrations.py,sha256=-kCWXOmilJKXCxe1LKob8sfVCQhcWambEa9asTCobKg,7248
89
+ htmlgraph/docs/template_engine.py,sha256=aRr7hUcCoXOPzZlxifmxNr3nImOvla-X3qYYWKfXDMw,4825
90
+ htmlgraph/docs/version_check.py,sha256=4zhplgv42k8REik4fU9Q2LANZoSRv7uSzGQGdVKj5VI,4892
91
+ htmlgraph/docs/templates/base_agents.md.j2,sha256=s3qyWyx4XWkeeqmWGtnsK0AsDOhBA108Cc2lbA08VfE,1713
92
+ htmlgraph/docs/templates/example_user_override.md.j2,sha256=BYm_p9qP21hjAF7zwGfx1NU8PTlQ00yphk-leHsMHDY,1361
93
+ htmlgraph/docs/templates/_sections/cli_reference.md.j2,sha256=TItgng09Qxre2EdqXdq-R2RhS9IW5W7mis-vjpWGKA4,806
94
+ htmlgraph/docs/templates/_sections/core_concepts.md.j2,sha256=7kkyaKiKOqMg5NF_IIRxdDk5RGfq0vnRZd6ZBI5_mUE,738
95
+ htmlgraph/docs/templates/_sections/sdk_basics.md.j2,sha256=XEL90BQvTKa4xiWkCO96CT9ddp47IiBOoMDrpZOL2B0,1334
85
96
  htmlgraph/extensions/gemini/GEMINI.md,sha256=fRUP-u1UmUTuRVbQ32sK3iYQAFYGYRyjU0W0_igT6GA,20462
86
97
  htmlgraph/extensions/gemini/README.md,sha256=PDWQDi6IA8Jq6ZMrEn9jpLygbSjp41Chtl2wGSm5Y1c,7116
87
98
  htmlgraph/extensions/gemini/gemini-extension.json,sha256=-CU-34hZkmw8gx-Tdojjuytf12LfArzCBMVFyc8X_Eo,493
@@ -113,12 +124,12 @@ htmlgraph/services/claiming.py,sha256=HcrltEJKN72mxuD7fGuXWeh1U0vwhjMvhZcFc02Eiy
113
124
  htmlgraph/templates/AGENTS.md.template,sha256=f96h7V6ygwj-v-fanVI48eYMxR6t_se4bet1H4ZsDpI,7642
114
125
  htmlgraph/templates/CLAUDE.md.template,sha256=h1kG2hTX2XYig2KszsHBfzrwa_4Cfcq2Pj4SwqzeDlM,1984
115
126
  htmlgraph/templates/GEMINI.md.template,sha256=gAGzE53Avki87BM_otqy5HdcYCoLsHgqaKjVzNzPMX8,1622
116
- htmlgraph-0.21.0.data/data/htmlgraph/dashboard.html,sha256=rkZYjSnPbUuAm35QMpCNWemenYqQTdkkumCX2hhe8Dc,173537
117
- htmlgraph-0.21.0.data/data/htmlgraph/styles.css,sha256=oDUSC8jG-V-hKojOBO9J88hxAeY2wJrBYTq0uCwX_Y4,7135
118
- htmlgraph-0.21.0.data/data/htmlgraph/templates/AGENTS.md.template,sha256=f96h7V6ygwj-v-fanVI48eYMxR6t_se4bet1H4ZsDpI,7642
119
- htmlgraph-0.21.0.data/data/htmlgraph/templates/CLAUDE.md.template,sha256=h1kG2hTX2XYig2KszsHBfzrwa_4Cfcq2Pj4SwqzeDlM,1984
120
- htmlgraph-0.21.0.data/data/htmlgraph/templates/GEMINI.md.template,sha256=gAGzE53Avki87BM_otqy5HdcYCoLsHgqaKjVzNzPMX8,1622
121
- htmlgraph-0.21.0.dist-info/METADATA,sha256=imvjH4WNDmGZNWZ9atUaBoHlxiOfjlAxGrzE0XfHoY8,7645
122
- htmlgraph-0.21.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
123
- htmlgraph-0.21.0.dist-info/entry_points.txt,sha256=EaUbjA_bbDwEO_XDLEGMeK8aQP-ZnHiUTkLshyKDyB8,98
124
- htmlgraph-0.21.0.dist-info/RECORD,,
127
+ htmlgraph-0.22.0.data/data/htmlgraph/dashboard.html,sha256=rkZYjSnPbUuAm35QMpCNWemenYqQTdkkumCX2hhe8Dc,173537
128
+ htmlgraph-0.22.0.data/data/htmlgraph/styles.css,sha256=oDUSC8jG-V-hKojOBO9J88hxAeY2wJrBYTq0uCwX_Y4,7135
129
+ htmlgraph-0.22.0.data/data/htmlgraph/templates/AGENTS.md.template,sha256=f96h7V6ygwj-v-fanVI48eYMxR6t_se4bet1H4ZsDpI,7642
130
+ htmlgraph-0.22.0.data/data/htmlgraph/templates/CLAUDE.md.template,sha256=h1kG2hTX2XYig2KszsHBfzrwa_4Cfcq2Pj4SwqzeDlM,1984
131
+ htmlgraph-0.22.0.data/data/htmlgraph/templates/GEMINI.md.template,sha256=gAGzE53Avki87BM_otqy5HdcYCoLsHgqaKjVzNzPMX8,1622
132
+ htmlgraph-0.22.0.dist-info/METADATA,sha256=F9jdZlZyFDN5s8kmlCHt6-vooZMxu_Gkc2OwAJljNYE,7645
133
+ htmlgraph-0.22.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
134
+ htmlgraph-0.22.0.dist-info/entry_points.txt,sha256=EaUbjA_bbDwEO_XDLEGMeK8aQP-ZnHiUTkLshyKDyB8,98
135
+ htmlgraph-0.22.0.dist-info/RECORD,,