htmlgraph 0.27.5__py3-none-any.whl → 0.27.7__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.
htmlgraph/__init__.py CHANGED
@@ -90,6 +90,11 @@ from htmlgraph.reflection import ComputationalReflection, get_reflection_context
90
90
  from htmlgraph.repo_hash import RepoHash
91
91
  from htmlgraph.sdk import SDK
92
92
  from htmlgraph.server import serve
93
+ from htmlgraph.session_context import (
94
+ GitHooksInstaller,
95
+ SessionContextBuilder,
96
+ VersionChecker,
97
+ )
93
98
  from htmlgraph.session_manager import SessionManager
94
99
  from htmlgraph.session_registry import SessionRegistry
95
100
  from htmlgraph.types import (
@@ -118,7 +123,7 @@ from htmlgraph.types import (
118
123
  )
119
124
  from htmlgraph.work_type_utils import infer_work_type, infer_work_type_from_id
120
125
 
121
- __version__ = "0.27.5"
126
+ __version__ = "0.27.7"
122
127
  __all__ = [
123
128
  # Exceptions
124
129
  "HtmlGraphError",
@@ -160,6 +165,9 @@ __all__ = [
160
165
  "find_all",
161
166
  "AgentInterface",
162
167
  "SessionManager",
168
+ "SessionContextBuilder",
169
+ "VersionChecker",
170
+ "GitHooksInstaller",
163
171
  "SessionRegistry",
164
172
  "RepoHash",
165
173
  "SDK",
@@ -425,3 +425,63 @@ class OperationsMixin:
425
425
  from htmlgraph.operations import analytics
426
426
 
427
427
  return analytics.get_recommendations(graph_dir=self._directory)
428
+
429
+ def init_project(self, directory: Path | None = None) -> dict[str, Any]:
430
+ """
431
+ Initialize HtmlGraph directory structure.
432
+
433
+ Creates .htmlgraph/ with subdirectories:
434
+ - features/, sessions/, tracks/, spikes/
435
+ - bugs/, patterns/, insights/, metrics/
436
+ - todos/, task-delegations/
437
+
438
+ Args:
439
+ directory: Base directory (defaults to current working directory)
440
+
441
+ Returns:
442
+ Dict with status ("created" or "already_exists") and directories list
443
+
444
+ Example:
445
+ >>> sdk = SDK(agent="claude")
446
+ >>> result = sdk.init_project()
447
+ >>> print(result['status']) # "created"
448
+ >>> print(result['directories']) # ['features', 'sessions', ...]
449
+ """
450
+ from pathlib import Path
451
+
452
+ base_dir = directory or Path.cwd() / ".htmlgraph"
453
+
454
+ # Check if already initialized
455
+ if base_dir.exists():
456
+ existing_dirs = [d.name for d in base_dir.iterdir() if d.is_dir()]
457
+ return {
458
+ "status": "already_exists",
459
+ "directories": existing_dirs,
460
+ "path": str(base_dir),
461
+ }
462
+
463
+ # Create directory structure
464
+ dirs = [
465
+ "features",
466
+ "sessions",
467
+ "tracks",
468
+ "spikes",
469
+ "bugs",
470
+ "patterns",
471
+ "insights",
472
+ "metrics",
473
+ "todos",
474
+ "task-delegations",
475
+ ]
476
+
477
+ created = []
478
+ for dirname in dirs:
479
+ dir_path = base_dir / dirname
480
+ dir_path.mkdir(parents=True, exist_ok=True)
481
+ created.append(dirname)
482
+
483
+ return {
484
+ "status": "created",
485
+ "directories": created,
486
+ "path": str(base_dir),
487
+ }