htmlgraph 0.2.0__tar.gz → 0.2.2__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 (45) hide show
  1. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/PKG-INFO +36 -3
  2. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/README.md +35 -2
  3. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/pyproject.toml +1 -1
  4. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/src/python/htmlgraph/cli.py +101 -0
  5. htmlgraph-0.2.2/src/python/htmlgraph/setup.py +293 -0
  6. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/.gitignore +0 -0
  7. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/examples/create_auth_track_demo.py +0 -0
  8. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/examples/create_htmlgraph_dev_track.py +0 -0
  9. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/examples/sdk_demo.py +0 -0
  10. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/examples/todo-list/demo.py +0 -0
  11. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/examples/todo-list/index.html +0 -0
  12. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/examples/todo-list/styles.css +0 -0
  13. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/examples/todo-list/task-001.html +0 -0
  14. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/examples/todo-list/task-002.html +0 -0
  15. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/examples/todo-list/task-003.html +0 -0
  16. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/examples/todo-list/task-004.html +0 -0
  17. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/examples/todo-list/task-005.html +0 -0
  18. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/src/python/htmlgraph/__init__.py +0 -0
  19. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/src/python/htmlgraph/agents.py +0 -0
  20. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/src/python/htmlgraph/analytics_index.py +0 -0
  21. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/src/python/htmlgraph/converter.py +0 -0
  22. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/src/python/htmlgraph/dashboard.html +0 -0
  23. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/src/python/htmlgraph/event_log.py +0 -0
  24. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/src/python/htmlgraph/event_migration.py +0 -0
  25. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/src/python/htmlgraph/file_watcher.py +0 -0
  26. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/src/python/htmlgraph/git_events.py +0 -0
  27. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/src/python/htmlgraph/graph.py +0 -0
  28. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/src/python/htmlgraph/mcp_server.py +0 -0
  29. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/src/python/htmlgraph/models.py +0 -0
  30. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/src/python/htmlgraph/parser.py +0 -0
  31. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/src/python/htmlgraph/planning.py +0 -0
  32. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/src/python/htmlgraph/sdk.py +0 -0
  33. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/src/python/htmlgraph/server.py +0 -0
  34. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/src/python/htmlgraph/session_manager.py +0 -0
  35. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/src/python/htmlgraph/styles.css +0 -0
  36. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/src/python/htmlgraph/track_manager.py +0 -0
  37. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/src/python/htmlgraph/watch.py +0 -0
  38. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/tests/python/__init__.py +0 -0
  39. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/tests/python/test_cli_commands.py +0 -0
  40. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/tests/python/test_dashboard_ui.py +0 -0
  41. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/tests/python/test_event_index.py +0 -0
  42. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/tests/python/test_git_events.py +0 -0
  43. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/tests/python/test_mcp_server.py +0 -0
  44. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/tests/python/test_mcp_stdio_transport.py +0 -0
  45. {htmlgraph-0.2.0 → htmlgraph-0.2.2}/tests/python/test_models.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: htmlgraph
3
- Version: 0.2.0
3
+ Version: 0.2.2
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
@@ -209,6 +209,38 @@ HtmlGraph nodes are standard HTML files:
209
209
  3. **Documentation** - Interconnected docs with search
210
210
  4. **Task Management** - Todo lists with dependencies
211
211
 
212
+ ## Contributing
213
+
214
+ HtmlGraph is developed using HtmlGraph itself (dogfooding). This means:
215
+
216
+ - ✅ Every development action is replicable by users through the package
217
+ - ✅ We use the SDK, CLI, and plugins - not custom scripts
218
+ - ✅ Our development workflow IS the documentation
219
+
220
+ **See [`docs/DEVELOPMENT.md`](docs/DEVELOPMENT.md) for:**
221
+ - Dogfooding principles
222
+ - Replicable workflows
223
+ - Environment setup (PyPI tokens, etc.)
224
+ - Development best practices
225
+
226
+ **Quick start for contributors:**
227
+ ```bash
228
+ # Clone and setup
229
+ git clone https://github.com/Shakes-tzd/htmlgraph
230
+ cd htmlgraph
231
+ uv sync
232
+
233
+ # Start tracking your work (dogfooding!)
234
+ uv run htmlgraph init --install-hooks
235
+ uv run htmlgraph serve # View dashboard
236
+
237
+ # Use SDK for development
238
+ uv run python
239
+ >>> from htmlgraph import SDK
240
+ >>> sdk = SDK(agent="your-name")
241
+ >>> sdk.features.where(status="todo")
242
+ ```
243
+
212
244
  ## License
213
245
 
214
246
  MIT
@@ -216,5 +248,6 @@ MIT
216
248
  ## Links
217
249
 
218
250
  - [GitHub](https://github.com/Shakes-tzd/htmlgraph)
219
- - [Documentation](https://github.com/Shakes-tzd/htmlgraph#readme)
220
- - [Examples](https://github.com/Shakes-tzd/htmlgraph/tree/main/examples)
251
+ - [Documentation](docs/) - SDK guide, workflows, development principles
252
+ - [Examples](examples/) - Real-world usage examples
253
+ - [PyPI](https://pypi.org/project/htmlgraph/)
@@ -175,6 +175,38 @@ HtmlGraph nodes are standard HTML files:
175
175
  3. **Documentation** - Interconnected docs with search
176
176
  4. **Task Management** - Todo lists with dependencies
177
177
 
178
+ ## Contributing
179
+
180
+ HtmlGraph is developed using HtmlGraph itself (dogfooding). This means:
181
+
182
+ - ✅ Every development action is replicable by users through the package
183
+ - ✅ We use the SDK, CLI, and plugins - not custom scripts
184
+ - ✅ Our development workflow IS the documentation
185
+
186
+ **See [`docs/DEVELOPMENT.md`](docs/DEVELOPMENT.md) for:**
187
+ - Dogfooding principles
188
+ - Replicable workflows
189
+ - Environment setup (PyPI tokens, etc.)
190
+ - Development best practices
191
+
192
+ **Quick start for contributors:**
193
+ ```bash
194
+ # Clone and setup
195
+ git clone https://github.com/Shakes-tzd/htmlgraph
196
+ cd htmlgraph
197
+ uv sync
198
+
199
+ # Start tracking your work (dogfooding!)
200
+ uv run htmlgraph init --install-hooks
201
+ uv run htmlgraph serve # View dashboard
202
+
203
+ # Use SDK for development
204
+ uv run python
205
+ >>> from htmlgraph import SDK
206
+ >>> sdk = SDK(agent="your-name")
207
+ >>> sdk.features.where(status="todo")
208
+ ```
209
+
178
210
  ## License
179
211
 
180
212
  MIT
@@ -182,5 +214,6 @@ MIT
182
214
  ## Links
183
215
 
184
216
  - [GitHub](https://github.com/Shakes-tzd/htmlgraph)
185
- - [Documentation](https://github.com/Shakes-tzd/htmlgraph#readme)
186
- - [Examples](https://github.com/Shakes-tzd/htmlgraph/tree/main/examples)
217
+ - [Documentation](docs/) - SDK guide, workflows, development principles
218
+ - [Examples](examples/) - Real-world usage examples
219
+ - [PyPI](https://pypi.org/project/htmlgraph/)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "htmlgraph"
3
- version = "0.2.0"
3
+ version = "0.2.2"
4
4
  description = "HTML is All You Need - Graph database on web standards"
5
5
  authors = [{name = "Shakes", email = "shakestzd@gmail.com"}]
6
6
  readme = "README.md"
@@ -236,6 +236,75 @@ fi
236
236
 
237
237
  printf "%s" "$UPDATES" | htmlgraph git-event push "$REMOTE_NAME" "$REMOTE_URL" &> /dev/null &
238
238
  exit 0
239
+ """
240
+
241
+ pre_commit = """#!/bin/bash
242
+ #
243
+ # HtmlGraph Pre-Commit Hook
244
+ # Reminds developers to create/start features for non-trivial work
245
+ #
246
+ # To disable: git config htmlgraph.precommit false
247
+ # To bypass once: git commit --no-verify
248
+
249
+ # Check if hook is disabled via config
250
+ if [ "$(git config --type=bool htmlgraph.precommit)" = "false" ]; then
251
+ exit 0
252
+ fi
253
+
254
+ # Check if HtmlGraph is initialized
255
+ if [ ! -d ".htmlgraph" ]; then
256
+ # Not an HtmlGraph project, skip silently
257
+ exit 0
258
+ fi
259
+
260
+ # Fast check for in-progress features using grep (avoids Python startup)
261
+ # This is 10-100x faster than calling the CLI
262
+ ACTIVE_COUNT=$(find .htmlgraph/features -name "*.html" -exec grep -l 'data-status="in-progress"' {} \\; 2>/dev/null | wc -l | tr -d ' ')
263
+
264
+ # If we have active features and htmlgraph CLI is available, get details
265
+ if [ "$ACTIVE_COUNT" -gt 0 ] && command -v htmlgraph &> /dev/null; then
266
+ ACTIVE_FEATURES=$(htmlgraph feature list --status in-progress 2>/dev/null)
267
+ else
268
+ ACTIVE_FEATURES=""
269
+ fi
270
+
271
+ # Redirect output to stderr (standard for git hooks)
272
+ exec 1>&2
273
+
274
+ if [ "$ACTIVE_COUNT" -gt 0 ]; then
275
+ # Active features exist - show them
276
+ echo ""
277
+ echo "✓ HtmlGraph: $ACTIVE_COUNT active feature(s)"
278
+ echo ""
279
+ echo "$ACTIVE_FEATURES"
280
+ echo ""
281
+ else
282
+ # No active features - show reminder
283
+ echo ""
284
+ echo "⚠️ HtmlGraph Feature Reminder"
285
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
286
+ echo "No active features found. Did you forget to start one?"
287
+ echo ""
288
+ echo "For non-trivial work, consider:"
289
+ echo " 1. Create feature: (use Python API or dashboard)"
290
+ echo " 2. Start feature: htmlgraph feature start <feature-id>"
291
+ echo ""
292
+ echo "Quick decision:"
293
+ echo " • >30 min work? → Create feature"
294
+ echo " • 3+ files? → Create feature"
295
+ echo " • Needs tests? → Create feature"
296
+ echo " • Simple fix? → Direct commit OK"
297
+ echo ""
298
+ echo "To disable this reminder: git config htmlgraph.precommit false"
299
+ echo "To bypass once: git commit --no-verify"
300
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
301
+ echo ""
302
+ echo "Proceeding with commit..."
303
+ echo ""
304
+ fi
305
+
306
+ # Always exit 0 (allow commit)
307
+ exit 0
239
308
  """
240
309
 
241
310
  def ensure_hook_file(hook_name: str, hook_content: str) -> Path:
@@ -249,6 +318,7 @@ exit 0
249
318
  return hook_dest
250
319
 
251
320
  hook_files = {
321
+ "pre-commit": ensure_hook_file("pre-commit", pre_commit),
252
322
  "post-commit": ensure_hook_file("post-commit", post_commit),
253
323
  "post-checkout": ensure_hook_file("post-checkout", post_checkout),
254
324
  "post-merge": ensure_hook_file("post-merge", post_merge),
@@ -325,6 +395,7 @@ fi
325
395
  print(f"\n✓ Git hooks installed")
326
396
  print(f" {hook_name}: {git_hook_path}")
327
397
 
398
+ install_hook("pre-commit", hook_files["pre-commit"], pre_commit)
328
399
  install_hook("post-commit", hook_files["post-commit"], post_commit)
329
400
  install_hook("post-checkout", hook_files["post-checkout"], post_checkout)
330
401
  install_hook("post-merge", hook_files["post-merge"], post_merge)
@@ -1609,6 +1680,22 @@ curl Examples:
1609
1680
  mcp_serve.add_argument("--graph-dir", "-g", default=".htmlgraph", help="Graph directory")
1610
1681
  mcp_serve.add_argument("--agent", default="mcp", help="Agent name for session attribution")
1611
1682
 
1683
+ # setup
1684
+ setup_parser = subparsers.add_parser("setup", help="Set up HtmlGraph for AI CLI platforms")
1685
+ setup_subparsers = setup_parser.add_subparsers(dest="setup_command", help="Platform to set up")
1686
+
1687
+ setup_claude = setup_subparsers.add_parser("claude", help="Set up for Claude Code")
1688
+ setup_claude.add_argument("--auto-install", action="store_true", help="Automatically install when possible")
1689
+
1690
+ setup_codex = setup_subparsers.add_parser("codex", help="Set up for Codex CLI")
1691
+ setup_codex.add_argument("--auto-install", action="store_true", help="Automatically install when possible")
1692
+
1693
+ setup_gemini = setup_subparsers.add_parser("gemini", help="Set up for Gemini CLI")
1694
+ setup_gemini.add_argument("--auto-install", action="store_true", help="Automatically install when possible")
1695
+
1696
+ setup_all_parser = setup_subparsers.add_parser("all", help="Set up for all supported platforms")
1697
+ setup_all_parser.add_argument("--auto-install", action="store_true", help="Automatically install when possible")
1698
+
1612
1699
  args = parser.parse_args()
1613
1700
 
1614
1701
  if args.command == "serve":
@@ -1694,6 +1781,20 @@ curl Examples:
1694
1781
  else:
1695
1782
  mcp_parser.print_help()
1696
1783
  sys.exit(1)
1784
+ elif args.command == "setup":
1785
+ from htmlgraph.setup import setup_claude, setup_codex, setup_gemini, setup_all
1786
+
1787
+ if args.setup_command == "claude":
1788
+ setup_claude(args)
1789
+ elif args.setup_command == "codex":
1790
+ setup_codex(args)
1791
+ elif args.setup_command == "gemini":
1792
+ setup_gemini(args)
1793
+ elif args.setup_command == "all":
1794
+ setup_all(args)
1795
+ else:
1796
+ setup_parser.print_help()
1797
+ sys.exit(1)
1697
1798
  else:
1698
1799
  parser.print_help()
1699
1800
  sys.exit(1)
@@ -0,0 +1,293 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ HtmlGraph CLI Setup Commands
4
+
5
+ Automates setup of HtmlGraph for different AI CLI platforms:
6
+ - Claude Code (plugin via marketplace)
7
+ - Codex CLI (skill installation)
8
+ - Gemini CLI (extension installation)
9
+ """
10
+
11
+ import json
12
+ import os
13
+ import shutil
14
+ import subprocess
15
+ import sys
16
+ from pathlib import Path
17
+ from typing import Optional
18
+
19
+
20
+ def check_command_exists(command: str) -> bool:
21
+ """Check if a command exists in PATH."""
22
+ return shutil.which(command) is not None
23
+
24
+
25
+ def run_command(cmd: list[str], capture=False, check=True) -> subprocess.CompletedProcess:
26
+ """Run a shell command."""
27
+ try:
28
+ if capture:
29
+ result = subprocess.run(cmd, capture_output=True, text=True, check=check)
30
+ else:
31
+ result = subprocess.run(cmd, check=check)
32
+ return result
33
+ except subprocess.CalledProcessError as e:
34
+ print(f"Error running command: {' '.join(cmd)}")
35
+ print(f"Exit code: {e.returncode}")
36
+ if capture and e.stderr:
37
+ print(f"Error: {e.stderr}")
38
+ raise
39
+
40
+
41
+ def setup_claude(args):
42
+ """Set up HtmlGraph for Claude Code."""
43
+ print("🔧 Setting up HtmlGraph for Claude Code...")
44
+ print()
45
+
46
+ # Check if claude CLI exists
47
+ if not check_command_exists("claude"):
48
+ print("❌ Claude Code CLI not found")
49
+ print(" Install from: https://claude.com/download")
50
+ return False
51
+
52
+ print("✅ Claude Code CLI found")
53
+
54
+ # Check if marketplace is configured
55
+ print("\n📦 Checking marketplace configuration...")
56
+
57
+ # Get project root (where .htmlgraph might be)
58
+ project_root = Path.cwd()
59
+ marketplace_file = project_root / ".claude-plugin" / "marketplace.json"
60
+
61
+ if marketplace_file.exists():
62
+ print(f"✅ Marketplace configured at {marketplace_file}")
63
+ else:
64
+ print("⚠️ No local marketplace found")
65
+ print(" If you're developing HtmlGraph, you should be in the repo root")
66
+ print(" Otherwise, the plugin is available from the official marketplace")
67
+
68
+ # Check if plugin is installed
69
+ print("\n📋 Checking installed plugins...")
70
+ try:
71
+ result = run_command(["claude", "plugin", "list"], capture=True)
72
+ if "htmlgraph" in result.stdout:
73
+ print("✅ HtmlGraph plugin already installed")
74
+
75
+ # Try to get version
76
+ if "@" in result.stdout:
77
+ version_line = [line for line in result.stdout.split("\n") if "htmlgraph" in line]
78
+ if version_line:
79
+ print(f" {version_line[0].strip()}")
80
+ else:
81
+ print("⚠️ HtmlGraph plugin not installed")
82
+ print("\n📥 Install the plugin:")
83
+
84
+ if marketplace_file.exists():
85
+ print(" From local marketplace:")
86
+ print(" 1. /plugin marketplace add .")
87
+ print(" 2. /plugin install htmlgraph@htmlgraph-dev")
88
+ else:
89
+ print(" From official marketplace:")
90
+ print(" /plugin install htmlgraph")
91
+ except Exception as e:
92
+ print(f"⚠️ Could not check plugins: {e}")
93
+
94
+ print("\n✅ Claude Code setup complete!")
95
+ print("\n📚 Next steps:")
96
+ print(" 1. Restart Claude Code if plugin was just installed")
97
+ print(" 2. Run: htmlgraph init --install-hooks")
98
+ print(" 3. Start coding - tracking is automatic!")
99
+ return True
100
+
101
+
102
+ def setup_codex(args):
103
+ """Set up HtmlGraph for Codex CLI."""
104
+ print("🔧 Setting up HtmlGraph for Codex CLI...")
105
+ print()
106
+
107
+ # Check if codex CLI exists
108
+ if not check_command_exists("codex"):
109
+ print("❌ Codex CLI not found")
110
+ print(" Install with: npm install -g @openai/codex")
111
+ return False
112
+
113
+ print("✅ Codex CLI found")
114
+
115
+ # Check if skills are enabled
116
+ print("\n🎯 Checking if skills are enabled...")
117
+ print(" Run: codex --enable skills")
118
+ print(" (This only needs to be done once)")
119
+
120
+ # Find or create skills directory
121
+ home = Path.home()
122
+ codex_dir = home / ".codex"
123
+ skills_dir = codex_dir / "skills"
124
+ htmlgraph_skill_dir = skills_dir / "htmlgraph-tracker"
125
+
126
+ print(f"\n📁 Skills directory: {skills_dir}")
127
+
128
+ if not skills_dir.exists():
129
+ print("⚠️ Skills directory doesn't exist yet")
130
+ print(" It will be created when you enable skills")
131
+ else:
132
+ print("✅ Skills directory exists")
133
+
134
+ # Check if skill is already installed
135
+ if htmlgraph_skill_dir.exists():
136
+ print(f"\n✅ HtmlGraph skill already installed at {htmlgraph_skill_dir}")
137
+
138
+ # Check if SKILL.md exists
139
+ skill_md = htmlgraph_skill_dir / "SKILL.md"
140
+ if skill_md.exists():
141
+ print("✅ SKILL.md found")
142
+ else:
143
+ print("⚠️ SKILL.md not found - skill may be incomplete")
144
+ else:
145
+ print(f"\n⚠️ HtmlGraph skill not installed")
146
+ print("\n📥 Installation options:")
147
+
148
+ # Check if we're in the HtmlGraph repo
149
+ repo_skill = Path.cwd() / "packages" / "codex-skill"
150
+ if repo_skill.exists():
151
+ print("\n Option 1: Link from this repo (recommended for development):")
152
+ print(f" ln -s {repo_skill.absolute()} {htmlgraph_skill_dir}")
153
+
154
+ if args.auto_install:
155
+ print("\n Auto-installing...")
156
+ skills_dir.mkdir(parents=True, exist_ok=True)
157
+ try:
158
+ if htmlgraph_skill_dir.exists():
159
+ htmlgraph_skill_dir.unlink()
160
+ htmlgraph_skill_dir.symlink_to(repo_skill.absolute())
161
+ print(f" ✅ Skill linked to {htmlgraph_skill_dir}")
162
+ except Exception as e:
163
+ print(f" ❌ Failed to link skill: {e}")
164
+
165
+ print("\n Option 2: Copy from GitHub:")
166
+ print(" git clone https://github.com/Shakes-tzd/htmlgraph.git")
167
+ print(f" cp -r htmlgraph/packages/codex-skill {htmlgraph_skill_dir}")
168
+
169
+ print("\n Option 3: Download manually:")
170
+ print(" https://github.com/Shakes-tzd/htmlgraph/tree/main/packages/codex-skill")
171
+
172
+ # Check MCP configuration
173
+ print("\n🔌 Checking MCP configuration...")
174
+ codex_config = codex_dir / "config.toml"
175
+
176
+ if codex_config.exists():
177
+ print(f"✅ Codex config found at {codex_config}")
178
+ print(" MCP servers can be configured in this file")
179
+ print(" Run: codex mcp serve")
180
+ else:
181
+ print("⚠️ No Codex config found yet")
182
+ print(" It will be created when you run Codex for the first time")
183
+
184
+ print("\n✅ Codex CLI setup complete!")
185
+ print("\n📚 Next steps:")
186
+ print(" 1. Enable skills: codex --enable skills")
187
+ print(" 2. Install the skill (see options above)")
188
+ print(" 3. Run: htmlgraph init --install-hooks")
189
+ print(" 4. Start Codex - skill will auto-activate!")
190
+ return True
191
+
192
+
193
+ def setup_gemini(args):
194
+ """Set up HtmlGraph for Gemini CLI."""
195
+ print("🔧 Setting up HtmlGraph for Gemini CLI...")
196
+ print()
197
+
198
+ # Check if gemini CLI exists
199
+ if not check_command_exists("gemini"):
200
+ print("❌ Gemini CLI not found")
201
+ print(" Install with: npm install -g @google/generative-ai-cli")
202
+ return False
203
+
204
+ print("✅ Gemini CLI found")
205
+
206
+ # Check for extensions
207
+ print("\n🎯 Checking for HtmlGraph extension...")
208
+
209
+ try:
210
+ result = run_command(["gemini", "extensions", "list"], capture=True, check=False)
211
+ if result.returncode == 0 and "htmlgraph" in result.stdout.lower():
212
+ print("✅ HtmlGraph extension already installed")
213
+ else:
214
+ print("⚠️ HtmlGraph extension not installed")
215
+ print("\n📥 Installation options:")
216
+
217
+ # Check if we're in the HtmlGraph repo
218
+ repo_extension = Path.cwd() / "packages" / "gemini-extension"
219
+ if repo_extension.exists():
220
+ print(f"\n Option 1: Install from this repo:")
221
+ print(f" gemini extensions install {repo_extension.absolute()}")
222
+
223
+ if args.auto_install:
224
+ print("\n Auto-installing...")
225
+ try:
226
+ run_command(["gemini", "extensions", "install", str(repo_extension.absolute())])
227
+ print(" ✅ Extension installed")
228
+ except Exception as e:
229
+ print(f" ❌ Failed to install extension: {e}")
230
+
231
+ print("\n Option 2: Install from GitHub:")
232
+ print(" gemini extensions install https://github.com/Shakes-tzd/htmlgraph/tree/main/packages/gemini-extension")
233
+
234
+ print("\n Option 3: Create manually:")
235
+ print(" gemini extensions create htmlgraph-tracker")
236
+ except Exception as e:
237
+ print(f"⚠️ Could not check extensions: {e}")
238
+
239
+ # Check hooks capability
240
+ print("\n🎉 Good news: Gemini CLI supports hooks!")
241
+ print(" The HtmlGraph extension includes automatic session tracking:")
242
+ print(" - SessionStart hook → Auto-start session")
243
+ print(" - AfterTool hook → Track all tool usage")
244
+ print(" - SessionEnd hook → Auto-finalize session")
245
+ print(" Just like Claude Code - no manual session management needed!")
246
+
247
+ print("\n✅ Gemini CLI setup complete!")
248
+ print("\n📚 Next steps:")
249
+ print(" 1. Install the extension (see options above)")
250
+ print(" 2. Run: htmlgraph init --install-hooks")
251
+ print(" 3. Start Gemini - tracking is automatic!")
252
+ return True
253
+
254
+
255
+ def setup_all(args):
256
+ """Set up HtmlGraph for all supported platforms."""
257
+ print("🚀 Setting up HtmlGraph for all supported platforms...")
258
+ print("=" * 60)
259
+ print()
260
+
261
+ results = {}
262
+
263
+ # Claude Code
264
+ print("1️⃣ CLAUDE CODE")
265
+ print("-" * 60)
266
+ results["claude"] = setup_claude(args)
267
+ print()
268
+ print()
269
+
270
+ # Codex CLI
271
+ print("2️⃣ CODEX CLI")
272
+ print("-" * 60)
273
+ results["codex"] = setup_codex(args)
274
+ print()
275
+ print()
276
+
277
+ # Gemini CLI
278
+ print("3️⃣ GEMINI CLI")
279
+ print("-" * 60)
280
+ results["gemini"] = setup_gemini(args)
281
+ print()
282
+ print()
283
+
284
+ # Summary
285
+ print("=" * 60)
286
+ print("📊 SETUP SUMMARY")
287
+ print("=" * 60)
288
+ for platform, success in results.items():
289
+ status = "✅" if success else "⚠️ "
290
+ print(f"{status} {platform.upper()}: {'Ready' if success else 'Needs attention'}")
291
+ print()
292
+
293
+ return all(results.values())
File without changes