tribunal-kit 4.0.1 → 4.3.0
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.
- package/.agent/ARCHITECTURE.md +21 -14
- package/.agent/GEMINI.md +4 -2
- package/.agent/agents/api-architect.md +66 -0
- package/.agent/agents/db-latency-auditor.md +216 -0
- package/.agent/agents/precedence-reviewer.md +41 -4
- package/.agent/agents/resilience-reviewer.md +88 -0
- package/.agent/agents/schema-reviewer.md +67 -0
- package/.agent/agents/swarm-worker-contracts.md +5 -5
- package/.agent/agents/throughput-optimizer.md +299 -0
- package/.agent/agents/ui-ux-auditor.md +292 -0
- package/.agent/agents/vitals-reviewer.md +223 -0
- package/.agent/history/case-law/cases/case-0001.json +33 -0
- package/.agent/history/case-law/index.json +35 -0
- package/.agent/rules/GEMINI.md +28 -11
- package/.agent/scripts/__pycache__/_colors.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/_utils.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/case_law_manager.cpython-311.pyc +0 -0
- package/.agent/scripts/_colors.js +18 -0
- package/.agent/scripts/_utils.js +42 -0
- package/.agent/scripts/auto_preview.js +197 -0
- package/.agent/scripts/bundle_analyzer.js +290 -0
- package/.agent/scripts/case_law_manager.js +684 -0
- package/.agent/scripts/checklist.js +266 -0
- package/.agent/scripts/colors.js +17 -0
- package/.agent/scripts/compress_skills.js +141 -0
- package/.agent/scripts/consolidate_skills.js +149 -0
- package/.agent/scripts/context_broker.js +609 -0
- package/.agent/scripts/deep_compress.js +150 -0
- package/.agent/scripts/dependency_analyzer.js +272 -0
- package/.agent/scripts/inner_loop_validator.js +465 -0
- package/.agent/scripts/lint_runner.js +187 -0
- package/.agent/scripts/minify_context.js +100 -0
- package/.agent/scripts/patch_skills_meta.js +156 -0
- package/.agent/scripts/patch_skills_output.js +244 -0
- package/.agent/scripts/schema_validator.js +297 -0
- package/.agent/scripts/security_scan.js +303 -0
- package/.agent/scripts/session_manager.js +276 -0
- package/.agent/scripts/skill_evolution.js +644 -0
- package/.agent/scripts/skill_integrator.js +313 -0
- package/.agent/scripts/strengthen_skills.js +193 -0
- package/.agent/scripts/strip_tribunal.js +47 -0
- package/.agent/scripts/swarm_dispatcher.js +360 -0
- package/.agent/scripts/test_runner.js +193 -0
- package/.agent/scripts/utils.js +32 -0
- package/.agent/scripts/verify_all.js +256 -0
- package/.agent/skills/agent-organizer/SKILL.md +42 -0
- package/.agent/skills/agentic-patterns/SKILL.md +42 -0
- package/.agent/skills/ai-prompt-injection-defense/SKILL.md +42 -0
- package/.agent/skills/api-patterns/SKILL.md +42 -0
- package/.agent/skills/api-security-auditor/SKILL.md +42 -0
- package/.agent/skills/app-builder/SKILL.md +42 -0
- package/.agent/skills/app-builder/templates/SKILL.md +70 -0
- package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +1 -1
- package/.agent/skills/appflow-wireframe/SKILL.md +42 -0
- package/.agent/skills/architecture/SKILL.md +42 -0
- package/.agent/skills/authentication-best-practices/SKILL.md +42 -0
- package/.agent/skills/bash-linux/SKILL.md +42 -0
- package/.agent/skills/behavioral-modes/SKILL.md +42 -0
- package/.agent/skills/brainstorming/SKILL.md +42 -0
- package/.agent/skills/building-native-ui/SKILL.md +42 -0
- package/.agent/skills/clean-code/SKILL.md +42 -0
- package/.agent/skills/code-review-checklist/SKILL.md +42 -0
- package/.agent/skills/config-validator/SKILL.md +42 -0
- package/.agent/skills/csharp-developer/SKILL.md +42 -0
- package/.agent/skills/data-validation-schemas/SKILL.md +320 -0
- package/.agent/skills/database-design/SKILL.md +42 -0
- package/.agent/skills/deployment-procedures/SKILL.md +42 -0
- package/.agent/skills/devops-engineer/SKILL.md +42 -0
- package/.agent/skills/devops-incident-responder/SKILL.md +42 -0
- package/.agent/skills/doc.md +1 -1
- package/.agent/skills/documentation-templates/SKILL.md +42 -0
- package/.agent/skills/edge-computing/SKILL.md +42 -0
- package/.agent/skills/error-resilience/SKILL.md +420 -0
- package/.agent/skills/extract-design-system/SKILL.md +42 -0
- package/.agent/skills/framer-motion-expert/SKILL.md +42 -1
- package/.agent/skills/frontend-design/SKILL.md +42 -0
- package/.agent/skills/game-design-expert/SKILL.md +42 -0
- package/.agent/skills/game-engineering-expert/SKILL.md +42 -0
- package/.agent/skills/geo-fundamentals/SKILL.md +42 -0
- package/.agent/skills/github-operations/SKILL.md +42 -0
- package/.agent/skills/gsap-core/SKILL.md +300 -0
- package/.agent/skills/gsap-frameworks/SKILL.md +199 -0
- package/.agent/skills/gsap-performance/SKILL.md +125 -0
- package/.agent/skills/gsap-plugins/SKILL.md +472 -0
- package/.agent/skills/gsap-react/SKILL.md +181 -0
- package/.agent/skills/gsap-scrolltrigger/SKILL.md +342 -0
- package/.agent/skills/gsap-timeline/SKILL.md +153 -0
- package/.agent/skills/gsap-utils/SKILL.md +330 -0
- package/.agent/skills/i18n-localization/SKILL.md +42 -0
- package/.agent/skills/intelligent-routing/SKILL.md +72 -1
- package/.agent/skills/lint-and-validate/SKILL.md +42 -0
- package/.agent/skills/llm-engineering/SKILL.md +42 -0
- package/.agent/skills/local-first/SKILL.md +42 -0
- package/.agent/skills/mcp-builder/SKILL.md +42 -0
- package/.agent/skills/mobile-design/SKILL.md +42 -0
- package/.agent/skills/monorepo-management/SKILL.md +326 -0
- package/.agent/skills/motion-engineering/SKILL.md +42 -0
- package/.agent/skills/nextjs-react-expert/SKILL.md +42 -0
- package/.agent/skills/nodejs-best-practices/SKILL.md +42 -0
- package/.agent/skills/observability/SKILL.md +42 -0
- package/.agent/skills/parallel-agents/SKILL.md +42 -0
- package/.agent/skills/performance-profiling/SKILL.md +42 -0
- package/.agent/skills/plan-writing/SKILL.md +42 -0
- package/.agent/skills/platform-engineer/SKILL.md +42 -0
- package/.agent/skills/playwright-best-practices/SKILL.md +42 -0
- package/.agent/skills/powershell-windows/SKILL.md +42 -0
- package/.agent/skills/project-idioms/SKILL.md +42 -0
- package/.agent/skills/python-patterns/SKILL.md +42 -0
- package/.agent/skills/python-pro/SKILL.md +42 -0
- package/.agent/skills/react-specialist/SKILL.md +42 -0
- package/.agent/skills/readme-builder/SKILL.md +42 -0
- package/.agent/skills/realtime-patterns/SKILL.md +42 -0
- package/.agent/skills/red-team-tactics/SKILL.md +42 -0
- package/.agent/skills/rust-pro/SKILL.md +42 -0
- package/.agent/skills/seo-fundamentals/SKILL.md +42 -0
- package/.agent/skills/server-management/SKILL.md +42 -0
- package/.agent/skills/shadcn-ui-expert/SKILL.md +42 -0
- package/.agent/skills/skill-creator/SKILL.md +42 -0
- package/.agent/skills/sql-pro/SKILL.md +42 -0
- package/.agent/skills/supabase-postgres-best-practices/SKILL.md +42 -0
- package/.agent/skills/swiftui-expert/SKILL.md +42 -0
- package/.agent/skills/systematic-debugging/SKILL.md +42 -0
- package/.agent/skills/tailwind-patterns/SKILL.md +42 -0
- package/.agent/skills/tdd-workflow/SKILL.md +42 -0
- package/.agent/skills/test-result-analyzer/SKILL.md +42 -0
- package/.agent/skills/testing-patterns/SKILL.md +42 -0
- package/.agent/skills/trend-researcher/SKILL.md +42 -0
- package/.agent/skills/typescript-advanced/SKILL.md +327 -0
- package/.agent/skills/ui-ux-pro-max/SKILL.md +42 -0
- package/.agent/skills/ui-ux-researcher/SKILL.md +42 -0
- package/.agent/skills/vue-expert/SKILL.md +42 -0
- package/.agent/skills/vulnerability-scanner/SKILL.md +42 -0
- package/.agent/skills/web-accessibility-auditor/SKILL.md +42 -0
- package/.agent/skills/web-design-guidelines/SKILL.md +42 -0
- package/.agent/skills/webapp-testing/SKILL.md +42 -0
- package/.agent/skills/whimsy-injector/SKILL.md +42 -0
- package/.agent/skills/workflow-optimizer/SKILL.md +42 -0
- package/.agent/workflows/audit.md +6 -6
- package/.agent/workflows/deploy.md +1 -1
- package/.agent/workflows/generate.md +23 -6
- package/.agent/workflows/session.md +5 -5
- package/.agent/workflows/swarm.md +2 -2
- package/.agent/workflows/tribunal-backend.md +13 -2
- package/.agent/workflows/tribunal-full.md +15 -8
- package/.agent/workflows/tribunal-speed.md +183 -0
- package/README.md +64 -8
- package/bin/tribunal-kit.js +281 -41
- package/package.json +9 -6
- package/scripts/changelog.js +167 -0
- package/scripts/sync-version.js +81 -0
- package/.agent/scripts/__pycache__/auto_preview.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/bundle_analyzer.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/checklist.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/dependency_analyzer.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/security_scan.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/session_manager.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/skill_integrator.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/swarm_dispatcher.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/test_runner.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/verify_all.cpython-311.pyc +0 -0
- package/.agent/scripts/auto_preview.py +0 -180
- package/.agent/scripts/bundle_analyzer.py +0 -259
- package/.agent/scripts/case_law_manager.py +0 -525
- package/.agent/scripts/checklist.py +0 -209
- package/.agent/scripts/compress_skills.py +0 -167
- package/.agent/scripts/consolidate_skills.py +0 -173
- package/.agent/scripts/deep_compress.py +0 -202
- package/.agent/scripts/dependency_analyzer.py +0 -247
- package/.agent/scripts/lint_runner.py +0 -188
- package/.agent/scripts/minify_context.py +0 -80
- package/.agent/scripts/patch_skills_meta.py +0 -177
- package/.agent/scripts/patch_skills_output.py +0 -285
- package/.agent/scripts/schema_validator.py +0 -279
- package/.agent/scripts/security_scan.py +0 -224
- package/.agent/scripts/session_manager.py +0 -261
- package/.agent/scripts/skill_evolution.py +0 -563
- package/.agent/scripts/skill_integrator.py +0 -234
- package/.agent/scripts/strengthen_skills.py +0 -220
- package/.agent/scripts/strip_tribunal.py +0 -41
- package/.agent/scripts/swarm_dispatcher.py +0 -350
- package/.agent/scripts/test_runner.py +0 -192
- package/.agent/scripts/test_swarm_dispatcher.py +0 -163
- package/.agent/scripts/verify_all.py +0 -195
- package/.agent/skills/gsap-expert/SKILL.md +0 -194
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""
|
|
3
|
-
session_manager.py — Agent session state tracking for multi-conversation work.
|
|
4
|
-
|
|
5
|
-
Usage:
|
|
6
|
-
python .agent/scripts/session_manager.py save "working on auth"
|
|
7
|
-
python .agent/scripts/session_manager.py load
|
|
8
|
-
python .agent/scripts/session_manager.py show
|
|
9
|
-
python .agent/scripts/session_manager.py clear
|
|
10
|
-
python .agent/scripts/session_manager.py status
|
|
11
|
-
python .agent/scripts/session_manager.py tag <label>
|
|
12
|
-
python .agent/scripts/session_manager.py list [--all]
|
|
13
|
-
python .agent/scripts/session_manager.py export [--stdout]
|
|
14
|
-
"""
|
|
15
|
-
|
|
16
|
-
import os
|
|
17
|
-
import sys
|
|
18
|
-
import json
|
|
19
|
-
from pathlib import Path
|
|
20
|
-
from datetime import datetime
|
|
21
|
-
|
|
22
|
-
STATE_FILE = ".agent_session.json"
|
|
23
|
-
|
|
24
|
-
GREEN = "\033[92m"
|
|
25
|
-
YELLOW = "\033[93m"
|
|
26
|
-
BLUE = "\033[94m"
|
|
27
|
-
CYAN = "\033[96m"
|
|
28
|
-
RED = "\033[91m"
|
|
29
|
-
BOLD = "\033[1m"
|
|
30
|
-
RESET = "\033[0m"
|
|
31
|
-
|
|
32
|
-
VALID_COMMANDS = {"save", "load", "show", "clear", "status", "tag", "list", "export"}
|
|
33
|
-
LIST_PAGE_SIZE = 10
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
def load_state() -> dict:
|
|
37
|
-
path = Path(STATE_FILE)
|
|
38
|
-
if not path.exists():
|
|
39
|
-
return {}
|
|
40
|
-
try:
|
|
41
|
-
with open(path) as f:
|
|
42
|
-
return json.load(f)
|
|
43
|
-
except (json.JSONDecodeError, IOError):
|
|
44
|
-
return {}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
def save_state(state: dict) -> None:
|
|
48
|
-
with open(STATE_FILE, "w") as f:
|
|
49
|
-
json.dump(state, f, indent=2)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
def cmd_save(note: str) -> None:
|
|
53
|
-
state = load_state()
|
|
54
|
-
entry = {
|
|
55
|
-
"timestamp": datetime.now().isoformat(),
|
|
56
|
-
"note": note,
|
|
57
|
-
"session": len(state.get("history", [])) + 1,
|
|
58
|
-
"tags": [],
|
|
59
|
-
}
|
|
60
|
-
state.setdefault("history", []).append(entry)
|
|
61
|
-
state["current"] = entry
|
|
62
|
-
save_state(state)
|
|
63
|
-
print(f"{GREEN}✅ Session saved:{RESET} {note}")
|
|
64
|
-
print(f" Time: {entry['timestamp']}")
|
|
65
|
-
print(f" Session: #{entry['session']}")
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
def cmd_load() -> None:
|
|
69
|
-
state = load_state()
|
|
70
|
-
current = state.get("current")
|
|
71
|
-
if not current:
|
|
72
|
-
print(f"{YELLOW}No active session — use 'save' first.{RESET}")
|
|
73
|
-
return
|
|
74
|
-
tags_str = (", ".join(current.get("tags", []))) or "none"
|
|
75
|
-
print(f"{BOLD}Current session:{RESET}")
|
|
76
|
-
print(f" Session: #{current['session']}")
|
|
77
|
-
print(f" Time: {current['timestamp']}")
|
|
78
|
-
print(f" Note: {current['note']}")
|
|
79
|
-
print(f" Tags: {tags_str}")
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
def cmd_show() -> None:
|
|
83
|
-
state = load_state()
|
|
84
|
-
history = state.get("history", [])
|
|
85
|
-
if not history:
|
|
86
|
-
print(f"{YELLOW}No session history.{RESET}")
|
|
87
|
-
return
|
|
88
|
-
print(f"{BOLD}Session History ({len(history)} total):{RESET}")
|
|
89
|
-
for entry in reversed(history[-10:]):
|
|
90
|
-
tags_str = (", ".join(entry.get("tags", []))) or ""
|
|
91
|
-
tags_display = f" [{tags_str}]" if tags_str else ""
|
|
92
|
-
print(f"\n {BLUE}#{entry['session']}{RESET} — {entry['timestamp'][:16]}{tags_display}")
|
|
93
|
-
print(f" {entry['note']}")
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
def cmd_clear() -> None:
|
|
97
|
-
path = Path(STATE_FILE)
|
|
98
|
-
if path.exists():
|
|
99
|
-
path.unlink()
|
|
100
|
-
print(f"{GREEN}✅ Session state cleared.{RESET}")
|
|
101
|
-
else:
|
|
102
|
-
print(f"{YELLOW}No session file found — nothing to clear.{RESET}")
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
def cmd_status() -> None:
|
|
106
|
-
"""Print a compact status summary of the last 3 sessions."""
|
|
107
|
-
state = load_state()
|
|
108
|
-
history = state.get("history", [])
|
|
109
|
-
current = state.get("current")
|
|
110
|
-
|
|
111
|
-
if not history:
|
|
112
|
-
print(f"{YELLOW}No session history — use 'save' to start tracking.{RESET}")
|
|
113
|
-
return
|
|
114
|
-
|
|
115
|
-
total = len(history)
|
|
116
|
-
recent = history[-3:]
|
|
117
|
-
|
|
118
|
-
print(f"\n{BOLD}{CYAN}━━━ Session Status ━━━━━━━━━━━━━━━━━━━━━━━━{RESET}")
|
|
119
|
-
print(f" Total sessions: {total}")
|
|
120
|
-
if current:
|
|
121
|
-
print(f" Active: #{current['session']} — {current['note'][:60]}")
|
|
122
|
-
print(f"\n{BOLD} Last 3 sessions:{RESET}")
|
|
123
|
-
for entry in reversed(recent):
|
|
124
|
-
tags_str = (", ".join(entry.get("tags", []))) or ""
|
|
125
|
-
tags_display = f" [{tags_str}]" if tags_str else ""
|
|
126
|
-
ts = entry["timestamp"][:16]
|
|
127
|
-
print(f" {BLUE}#{entry['session']}{RESET} {ts}{tags_display}")
|
|
128
|
-
print(f" {entry['note'][:70]}")
|
|
129
|
-
print(f"{CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━{RESET}\n")
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
def cmd_tag(label: str) -> None:
|
|
133
|
-
"""Add a tag label to the current session entry."""
|
|
134
|
-
if not label:
|
|
135
|
-
print(f"{RED}Error: provide a tag label. Example: session_manager.py tag v2-feature{RESET}")
|
|
136
|
-
sys.exit(1)
|
|
137
|
-
|
|
138
|
-
state = load_state()
|
|
139
|
-
current = state.get("current")
|
|
140
|
-
if not current:
|
|
141
|
-
print(f"{YELLOW}No active session — use 'save' first before tagging.{RESET}")
|
|
142
|
-
sys.exit(1)
|
|
143
|
-
|
|
144
|
-
# Tag must be applied to the same entry in history
|
|
145
|
-
current.setdefault("tags", [])
|
|
146
|
-
if label in current["tags"]:
|
|
147
|
-
print(f"{YELLOW}Tag '{label}' already exists on session #{current['session']}.{RESET}")
|
|
148
|
-
return
|
|
149
|
-
|
|
150
|
-
current["tags"].append(label)
|
|
151
|
-
state["current"] = current
|
|
152
|
-
|
|
153
|
-
# Also update the matching entry in history
|
|
154
|
-
for entry in state.get("history", []):
|
|
155
|
-
if entry.get("session") == current["session"]:
|
|
156
|
-
entry.setdefault("tags", [])
|
|
157
|
-
if label not in entry["tags"]:
|
|
158
|
-
entry["tags"].append(label)
|
|
159
|
-
break
|
|
160
|
-
|
|
161
|
-
save_state(state)
|
|
162
|
-
print(f"{GREEN}✅ Tagged session #{current['session']} with '{label}'.{RESET}")
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
def cmd_list(show_all: bool = False) -> None:
|
|
166
|
-
"""Paginated list of all session history."""
|
|
167
|
-
state = load_state()
|
|
168
|
-
history = state.get("history", [])
|
|
169
|
-
if not history:
|
|
170
|
-
print(f"{YELLOW}No session history.{RESET}")
|
|
171
|
-
return
|
|
172
|
-
|
|
173
|
-
total = len(history)
|
|
174
|
-
page_size = len(history) if show_all else LIST_PAGE_SIZE
|
|
175
|
-
recent = list(reversed(history))[:page_size]
|
|
176
|
-
|
|
177
|
-
print(f"\n{BOLD}{CYAN}━━━ Session List ({total} total, showing {len(recent)}) ━━━━━━━{RESET}")
|
|
178
|
-
for entry in recent:
|
|
179
|
-
tags_str = (", ".join(entry.get("tags", []))) or ""
|
|
180
|
-
tags_display = f" [{YELLOW}{tags_str}{RESET}]" if tags_str else ""
|
|
181
|
-
ts = entry["timestamp"][:16]
|
|
182
|
-
print(f"\n {BOLD}{BLUE}#{entry['session']}{RESET} — {ts}{tags_display}")
|
|
183
|
-
print(f" {entry['note']}")
|
|
184
|
-
|
|
185
|
-
if not show_all and total > page_size:
|
|
186
|
-
remaining = total - page_size
|
|
187
|
-
print(f"\n {YELLOW}... {remaining} older session(s) not shown. Use 'list --all' to see all.{RESET}")
|
|
188
|
-
|
|
189
|
-
print(f"{CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━{RESET}\n")
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
def cmd_export(to_stdout: bool = False) -> None:
|
|
193
|
-
"""Export all session history to a Markdown file or stdout."""
|
|
194
|
-
state = load_state()
|
|
195
|
-
history = state.get("history", [])
|
|
196
|
-
if not history:
|
|
197
|
-
print(f"{YELLOW}No session history to export.{RESET}")
|
|
198
|
-
return
|
|
199
|
-
|
|
200
|
-
lines = ["# Session Export\n"]
|
|
201
|
-
lines.append(f"Generated: {datetime.now().isoformat()[:16]}\n")
|
|
202
|
-
lines.append(f"Total sessions: {len(history)}\n\n---\n")
|
|
203
|
-
|
|
204
|
-
for entry in reversed(history):
|
|
205
|
-
session_num = entry.get("session", "?")
|
|
206
|
-
ts = entry.get("timestamp", "")[:16]
|
|
207
|
-
note = entry.get("note", "")
|
|
208
|
-
tags = entry.get("tags", [])
|
|
209
|
-
tags_str = f"\n**Tags:** {', '.join(tags)}" if tags else ""
|
|
210
|
-
lines.append(f"## Session #{session_num} — {ts}\n")
|
|
211
|
-
lines.append(f"{note}{tags_str}\n\n---\n")
|
|
212
|
-
|
|
213
|
-
content = "\n".join(lines)
|
|
214
|
-
|
|
215
|
-
if to_stdout:
|
|
216
|
-
print(content)
|
|
217
|
-
else:
|
|
218
|
-
export_path = Path("session_export.md")
|
|
219
|
-
with open(export_path, "w", encoding="utf-8") as f:
|
|
220
|
-
f.write(content)
|
|
221
|
-
print(f"{GREEN}✅ Exported {len(history)} sessions to{RESET} {export_path}")
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
def main() -> None:
|
|
225
|
-
if len(sys.argv) < 2:
|
|
226
|
-
print(f"Usage: session_manager.py [save <note>|load|show|clear|status|tag <label>|list [--all]|export [--stdout]]")
|
|
227
|
-
sys.exit(1)
|
|
228
|
-
|
|
229
|
-
cmd = sys.argv[1].lower()
|
|
230
|
-
|
|
231
|
-
if cmd not in VALID_COMMANDS:
|
|
232
|
-
print(f"{RED}Unknown command: '{cmd}'{RESET}")
|
|
233
|
-
print(f"Valid commands: {', '.join(sorted(VALID_COMMANDS))}")
|
|
234
|
-
sys.exit(1)
|
|
235
|
-
|
|
236
|
-
if cmd == "save":
|
|
237
|
-
note = " ".join(sys.argv[2:]).strip()
|
|
238
|
-
if not note:
|
|
239
|
-
note = f"session {datetime.now().strftime('%Y-%m-%d %H:%M')}"
|
|
240
|
-
cmd_save(note)
|
|
241
|
-
elif cmd == "load":
|
|
242
|
-
cmd_load()
|
|
243
|
-
elif cmd == "show":
|
|
244
|
-
cmd_show()
|
|
245
|
-
elif cmd == "clear":
|
|
246
|
-
cmd_clear()
|
|
247
|
-
elif cmd == "status":
|
|
248
|
-
cmd_status()
|
|
249
|
-
elif cmd == "tag":
|
|
250
|
-
label = " ".join(sys.argv[2:]).strip()
|
|
251
|
-
cmd_tag(label)
|
|
252
|
-
elif cmd == "list":
|
|
253
|
-
show_all = "--all" in sys.argv
|
|
254
|
-
cmd_list(show_all)
|
|
255
|
-
elif cmd == "export":
|
|
256
|
-
to_stdout = "--stdout" in sys.argv
|
|
257
|
-
cmd_export(to_stdout)
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
if __name__ == "__main__":
|
|
261
|
-
main()
|