empathy-framework 4.7.0__py3-none-any.whl → 4.8.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.
- empathy_framework-4.8.0.dist-info/METADATA +753 -0
- {empathy_framework-4.7.0.dist-info → empathy_framework-4.8.0.dist-info}/RECORD +83 -37
- {empathy_framework-4.7.0.dist-info → empathy_framework-4.8.0.dist-info}/WHEEL +1 -1
- {empathy_framework-4.7.0.dist-info → empathy_framework-4.8.0.dist-info}/entry_points.txt +2 -1
- empathy_os/__init__.py +2 -0
- empathy_os/cache/hash_only.py +6 -3
- empathy_os/cache/hybrid.py +6 -3
- empathy_os/cli/__init__.py +128 -238
- empathy_os/cli/__main__.py +5 -33
- empathy_os/cli/commands/__init__.py +1 -8
- empathy_os/cli/commands/help.py +331 -0
- empathy_os/cli/commands/info.py +140 -0
- empathy_os/cli/commands/inspect.py +437 -0
- empathy_os/cli/commands/metrics.py +92 -0
- empathy_os/cli/commands/orchestrate.py +184 -0
- empathy_os/cli/commands/patterns.py +207 -0
- empathy_os/cli/commands/provider.py +93 -81
- empathy_os/cli/commands/setup.py +96 -0
- empathy_os/cli/commands/status.py +235 -0
- empathy_os/cli/commands/sync.py +166 -0
- empathy_os/cli/commands/tier.py +121 -0
- empathy_os/cli/commands/workflow.py +574 -0
- empathy_os/cli/parsers/__init__.py +62 -0
- empathy_os/cli/parsers/help.py +41 -0
- empathy_os/cli/parsers/info.py +26 -0
- empathy_os/cli/parsers/inspect.py +66 -0
- empathy_os/cli/parsers/metrics.py +42 -0
- empathy_os/cli/parsers/orchestrate.py +61 -0
- empathy_os/cli/parsers/patterns.py +54 -0
- empathy_os/cli/parsers/provider.py +40 -0
- empathy_os/cli/parsers/setup.py +42 -0
- empathy_os/cli/parsers/status.py +47 -0
- empathy_os/cli/parsers/sync.py +31 -0
- empathy_os/cli/parsers/tier.py +33 -0
- empathy_os/cli/parsers/workflow.py +77 -0
- empathy_os/cli/utils/__init__.py +1 -0
- empathy_os/cli/utils/data.py +242 -0
- empathy_os/cli/utils/helpers.py +68 -0
- empathy_os/{cli.py → cli_legacy.py} +27 -27
- empathy_os/cli_minimal.py +662 -0
- empathy_os/cli_router.py +384 -0
- empathy_os/cli_unified.py +38 -2
- empathy_os/memory/__init__.py +19 -5
- empathy_os/memory/short_term.py +14 -404
- empathy_os/memory/types.py +437 -0
- empathy_os/memory/unified.py +61 -48
- empathy_os/models/fallback.py +1 -1
- empathy_os/models/provider_config.py +59 -344
- empathy_os/models/registry.py +31 -180
- empathy_os/monitoring/alerts.py +14 -20
- empathy_os/monitoring/alerts_cli.py +24 -7
- empathy_os/project_index/__init__.py +2 -0
- empathy_os/project_index/index.py +210 -5
- empathy_os/project_index/scanner.py +45 -14
- empathy_os/project_index/scanner_parallel.py +291 -0
- empathy_os/socratic/ab_testing.py +1 -1
- empathy_os/vscode_bridge 2.py +173 -0
- empathy_os/workflows/__init__.py +31 -2
- empathy_os/workflows/base.py +349 -325
- empathy_os/workflows/bug_predict.py +8 -0
- empathy_os/workflows/builder.py +273 -0
- empathy_os/workflows/caching.py +253 -0
- empathy_os/workflows/code_review_pipeline.py +1 -0
- empathy_os/workflows/history.py +510 -0
- empathy_os/workflows/output.py +410 -0
- empathy_os/workflows/perf_audit.py +125 -19
- empathy_os/workflows/progress.py +324 -22
- empathy_os/workflows/progressive/README 2.md +454 -0
- empathy_os/workflows/progressive/__init__ 2.py +92 -0
- empathy_os/workflows/progressive/cli 2.py +242 -0
- empathy_os/workflows/progressive/core 2.py +488 -0
- empathy_os/workflows/progressive/orchestrator 2.py +701 -0
- empathy_os/workflows/progressive/reports 2.py +528 -0
- empathy_os/workflows/progressive/telemetry 2.py +280 -0
- empathy_os/workflows/progressive/test_gen 2.py +514 -0
- empathy_os/workflows/progressive/workflow 2.py +628 -0
- empathy_os/workflows/routing.py +168 -0
- empathy_os/workflows/secure_release.py +1 -0
- empathy_os/workflows/security_audit.py +190 -0
- empathy_os/workflows/security_audit_phase3.py +328 -0
- empathy_os/workflows/telemetry_mixin.py +269 -0
- empathy_framework-4.7.0.dist-info/METADATA +0 -1598
- empathy_os/dashboard/__init__.py +0 -15
- empathy_os/dashboard/server.py +0 -941
- {empathy_framework-4.7.0.dist-info → empathy_framework-4.8.0.dist-info}/licenses/LICENSE +0 -0
- {empathy_framework-4.7.0.dist-info → empathy_framework-4.8.0.dist-info}/top_level.txt +0 -0
empathy_os/cli/__init__.py
CHANGED
|
@@ -1,262 +1,152 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""Empathy Framework CLI - Refactored modular structure.
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Usage:
|
|
6
|
-
empathy --help # Show all commands
|
|
7
|
-
empathy memory status # Memory control panel
|
|
8
|
-
empathy provider # Show provider config
|
|
9
|
-
empathy scan . # Scan codebase
|
|
10
|
-
empathy morning # Start-of-day briefing
|
|
3
|
+
Entry point for the empathy command-line interface.
|
|
11
4
|
|
|
12
5
|
Copyright 2025 Smart-AI-Memory
|
|
13
6
|
Licensed under Fair Source License 0.9
|
|
14
7
|
"""
|
|
15
8
|
|
|
16
|
-
import
|
|
9
|
+
import argparse
|
|
17
10
|
import sys
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
import
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
_legacy_cli_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "cli.py")
|
|
32
|
-
if os.path.exists(_legacy_cli_path):
|
|
33
|
-
_spec = importlib.util.spec_from_file_location("cli_legacy", _legacy_cli_path)
|
|
34
|
-
_cli_legacy = importlib.util.module_from_spec(_spec)
|
|
35
|
-
_spec.loader.exec_module(_cli_legacy)
|
|
36
|
-
|
|
37
|
-
# Re-export legacy functions
|
|
38
|
-
cmd_info = _cli_legacy.cmd_info
|
|
39
|
-
cmd_init = _cli_legacy.cmd_init
|
|
40
|
-
cmd_version = _cli_legacy.cmd_version
|
|
41
|
-
cmd_validate = _cli_legacy.cmd_validate
|
|
42
|
-
cmd_patterns_list = _cli_legacy.cmd_patterns_list
|
|
43
|
-
cmd_patterns_export = _cli_legacy.cmd_patterns_export
|
|
44
|
-
cmd_metrics_show = _cli_legacy.cmd_metrics_show
|
|
45
|
-
cmd_state_list = _cli_legacy.cmd_state_list
|
|
46
|
-
cmd_run = _cli_legacy.cmd_run
|
|
47
|
-
cmd_inspect = _cli_legacy.cmd_inspect
|
|
48
|
-
cmd_export = _cli_legacy.cmd_export
|
|
49
|
-
cmd_import = _cli_legacy.cmd_import
|
|
50
|
-
cmd_workflow = _cli_legacy.cmd_workflow
|
|
51
|
-
cmd_cheatsheet = _cli_legacy.cmd_cheatsheet
|
|
52
|
-
cmd_frameworks = _cli_legacy.cmd_frameworks
|
|
53
|
-
main_legacy = _cli_legacy.main
|
|
54
|
-
|
|
55
|
-
# Export for backward compatibility
|
|
56
|
-
__all__ = [
|
|
57
|
-
"app",
|
|
58
|
-
"main",
|
|
59
|
-
"cmd_info",
|
|
60
|
-
"cmd_init",
|
|
61
|
-
"cmd_version",
|
|
62
|
-
"cmd_validate",
|
|
63
|
-
"cmd_patterns_list",
|
|
64
|
-
"cmd_patterns_export",
|
|
65
|
-
"cmd_metrics_show",
|
|
66
|
-
"cmd_state_list",
|
|
67
|
-
"cmd_run",
|
|
68
|
-
"cmd_inspect",
|
|
69
|
-
"cmd_export",
|
|
70
|
-
"cmd_import",
|
|
71
|
-
"cmd_workflow",
|
|
72
|
-
"cmd_cheatsheet",
|
|
73
|
-
"cmd_frameworks",
|
|
74
|
-
]
|
|
75
|
-
except Exception: # noqa: BLE001
|
|
76
|
-
# INTENTIONAL: If legacy import fails, functions won't be available.
|
|
77
|
-
# New CLI still works; legacy re-exports are for backward compatibility only.
|
|
78
|
-
pass
|
|
79
|
-
|
|
80
|
-
from empathy_os.cli.commands import inspection
|
|
81
|
-
from empathy_os.cli.commands.memory import memory_app
|
|
82
|
-
from empathy_os.cli.commands.profiling import profile_app
|
|
83
|
-
from empathy_os.cli.commands.provider import provider_app
|
|
84
|
-
from empathy_os.cli.commands.utilities import utilities_app
|
|
85
|
-
from empathy_os.cli.core import console, get_empathy_version, version_callback
|
|
86
|
-
|
|
87
|
-
# Create the main Typer app
|
|
88
|
-
app = typer.Typer(
|
|
89
|
-
name="empathy",
|
|
90
|
-
help="Empathy Framework - Predictive AI-Developer Collaboration",
|
|
91
|
-
no_args_is_help=True,
|
|
92
|
-
rich_markup_mode="rich",
|
|
93
|
-
)
|
|
94
|
-
|
|
95
|
-
# Register command group apps
|
|
96
|
-
app.add_typer(memory_app, name="memory")
|
|
97
|
-
app.add_typer(profile_app, name="profile")
|
|
98
|
-
app.add_typer(provider_app, name="provider")
|
|
99
|
-
app.add_typer(utilities_app, name="utilities")
|
|
100
|
-
app.add_typer(utilities_app, name="utility", hidden=True) # Alias for common typo
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
@app.callback()
|
|
104
|
-
def callback(
|
|
105
|
-
version: bool = typer.Option(
|
|
106
|
-
None,
|
|
107
|
-
"--version",
|
|
108
|
-
"-v",
|
|
109
|
-
callback=version_callback,
|
|
110
|
-
is_eager=True,
|
|
111
|
-
help="Show version and exit",
|
|
112
|
-
),
|
|
113
|
-
) -> None:
|
|
114
|
-
"""Empathy Framework - Predictive AI-Developer Collaboration
|
|
115
|
-
|
|
116
|
-
The AI collaboration framework that predicts problems before they happen.
|
|
117
|
-
|
|
118
|
-
[bold]Quick Start:[/bold]
|
|
119
|
-
empathy morning Start-of-day briefing
|
|
120
|
-
empathy health Quick health check
|
|
121
|
-
empathy ship Pre-commit validation
|
|
122
|
-
|
|
123
|
-
[bold]Memory:[/bold]
|
|
124
|
-
empathy memory status Check memory system status
|
|
125
|
-
empathy memory start Start Redis server
|
|
126
|
-
|
|
127
|
-
[bold]Provider:[/bold]
|
|
128
|
-
empathy provider Show current provider config
|
|
129
|
-
empathy provider --set hybrid Configure provider
|
|
130
|
-
|
|
131
|
-
[bold]Inspection:[/bold]
|
|
132
|
-
empathy scan . Scan codebase for issues
|
|
133
|
-
empathy inspect . Deep inspection with SARIF output
|
|
11
|
+
|
|
12
|
+
from empathy_os.discovery import show_tip_if_available
|
|
13
|
+
from empathy_os.logging_config import get_logger
|
|
14
|
+
from empathy_os.platform_utils import setup_asyncio_policy
|
|
15
|
+
|
|
16
|
+
logger = get_logger(__name__)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def get_version() -> str:
|
|
20
|
+
"""Get package version.
|
|
21
|
+
|
|
22
|
+
Returns:
|
|
23
|
+
Version string or "dev" if not installed
|
|
134
24
|
"""
|
|
25
|
+
try:
|
|
26
|
+
from importlib.metadata import version
|
|
135
27
|
|
|
28
|
+
return version("empathy-framework")
|
|
29
|
+
except Exception: # noqa: BLE001
|
|
30
|
+
return "dev"
|
|
136
31
|
|
|
137
|
-
# =============================================================================
|
|
138
|
-
# SCAN/INSPECT COMMANDS (top-level)
|
|
139
|
-
# =============================================================================
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
@app.command("scan")
|
|
143
|
-
def scan(
|
|
144
|
-
path: Path = Path("."),
|
|
145
|
-
format_out: str = "text",
|
|
146
|
-
fix: bool = False,
|
|
147
|
-
staged: bool = False,
|
|
148
|
-
) -> None:
|
|
149
|
-
"""Scan codebase for issues."""
|
|
150
|
-
inspection.scan(path, format_out, fix, staged)
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
@app.command("inspect")
|
|
154
|
-
def inspect_cmd(
|
|
155
|
-
path: Path = Path("."),
|
|
156
|
-
format_out: str = "text",
|
|
157
|
-
) -> None:
|
|
158
|
-
"""Deep inspection with code analysis."""
|
|
159
|
-
inspection.inspect_cmd(path, format_out)
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
# =============================================================================
|
|
163
|
-
# WORKFLOW COMMANDS (delegate to legacy CLI for now)
|
|
164
|
-
# These will be extracted in Phase 2b
|
|
165
|
-
# =============================================================================
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
@app.command("ship")
|
|
169
|
-
def ship(
|
|
170
|
-
tests_only: bool = False,
|
|
171
|
-
security_only: bool = False,
|
|
172
|
-
skip_sync: bool = False,
|
|
173
|
-
) -> None:
|
|
174
|
-
"""Pre-commit validation (lint, format, tests, security)."""
|
|
175
|
-
args = [sys.executable, "-m", "empathy_os.cli", "ship"]
|
|
176
|
-
if tests_only:
|
|
177
|
-
args.append("--tests-only")
|
|
178
|
-
if security_only:
|
|
179
|
-
args.append("--security-only")
|
|
180
|
-
if skip_sync:
|
|
181
|
-
args.append("--skip-sync")
|
|
182
|
-
subprocess.run(args, check=False)
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
@app.command("health")
|
|
186
|
-
def health(
|
|
187
|
-
deep: bool = False,
|
|
188
|
-
fix: bool = False,
|
|
189
|
-
) -> None:
|
|
190
|
-
"""Quick health check (lint, types, tests)."""
|
|
191
|
-
args = [sys.executable, "-m", "empathy_os.cli", "health"]
|
|
192
|
-
if deep:
|
|
193
|
-
args.append("--deep")
|
|
194
|
-
if fix:
|
|
195
|
-
args.append("--fix")
|
|
196
|
-
subprocess.run(args, check=False)
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
@app.command("fix-all")
|
|
200
|
-
def fix_all() -> None:
|
|
201
|
-
"""Fix all lint and format issues."""
|
|
202
|
-
subprocess.run([sys.executable, "-m", "empathy_os.cli", "fix-all"], check=False)
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
@app.command("learn")
|
|
206
|
-
def learn(analyze: int = 20) -> None:
|
|
207
|
-
"""Learn patterns from commit history."""
|
|
208
|
-
subprocess.run(
|
|
209
|
-
[sys.executable, "-m", "empathy_os.cli", "learn", "--analyze", str(analyze)],
|
|
210
|
-
check=False,
|
|
211
|
-
)
|
|
212
32
|
|
|
33
|
+
def main() -> int:
|
|
34
|
+
"""Main CLI entry point.
|
|
35
|
+
|
|
36
|
+
This is the refactored CLI entry point that uses modular command
|
|
37
|
+
and parser organization instead of a monolithic 3,957-line file.
|
|
213
38
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
"""
|
|
217
|
-
|
|
39
|
+
Returns:
|
|
40
|
+
Exit code (0 for success, non-zero for error)
|
|
41
|
+
"""
|
|
42
|
+
# Windows async compatibility
|
|
43
|
+
setup_asyncio_policy()
|
|
218
44
|
|
|
45
|
+
# Create main parser
|
|
46
|
+
parser = argparse.ArgumentParser(
|
|
47
|
+
prog="empathy", description="Empathy Framework - Context-aware development automation"
|
|
48
|
+
)
|
|
219
49
|
|
|
220
|
-
#
|
|
221
|
-
|
|
222
|
-
# Import directly from cli_unified.py for now - will be extracted later
|
|
223
|
-
# =============================================================================
|
|
50
|
+
# Add global flags
|
|
51
|
+
parser.add_argument("--version", action="version", version=f"empathy {get_version()}")
|
|
224
52
|
|
|
225
|
-
#
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
from empathy_os.cli_unified import (
|
|
229
|
-
orchestrate_app,
|
|
230
|
-
progressive_app,
|
|
231
|
-
service_app,
|
|
232
|
-
telemetry_app,
|
|
233
|
-
tier_app,
|
|
234
|
-
workflow_app,
|
|
53
|
+
# Create subparsers
|
|
54
|
+
subparsers = parser.add_subparsers(
|
|
55
|
+
dest="command", title="commands", description="Available commands"
|
|
235
56
|
)
|
|
236
57
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
#
|
|
245
|
-
|
|
58
|
+
# Register all command parsers (modular!)
|
|
59
|
+
from .parsers import register_all_parsers
|
|
60
|
+
|
|
61
|
+
register_all_parsers(subparsers)
|
|
62
|
+
|
|
63
|
+
# TODO: Import and register remaining commands from cli.py
|
|
64
|
+
# This is a partial refactoring - additional commands still in cli.py
|
|
65
|
+
# For now, if command not found in new structure, fall back to old cli.py
|
|
66
|
+
#
|
|
67
|
+
# NOTE: Temporarily disabled to avoid conflicts with extracted commands.
|
|
68
|
+
# Commands that have been extracted:
|
|
69
|
+
# - help, tier, info, patterns, status (Phase 1)
|
|
70
|
+
# - workflow, inspect (run, inspect, export, import) (Phase 2)
|
|
71
|
+
# Once all commands are extracted, the old cli.py will be removed entirely.
|
|
72
|
+
#
|
|
73
|
+
# try:
|
|
74
|
+
# from empathy_os import cli as old_cli
|
|
75
|
+
# _register_legacy_commands(subparsers, old_cli)
|
|
76
|
+
# except ImportError:
|
|
77
|
+
# pass # Old cli.py not available or already moved
|
|
78
|
+
|
|
79
|
+
# Parse arguments
|
|
80
|
+
args = parser.parse_args()
|
|
81
|
+
|
|
82
|
+
# Execute command
|
|
83
|
+
if hasattr(args, "func"):
|
|
84
|
+
try:
|
|
85
|
+
result = args.func(args)
|
|
86
|
+
|
|
87
|
+
# Show discovery tips (except for dashboard/run)
|
|
88
|
+
if args.command and args.command not in ("dashboard", "run"):
|
|
89
|
+
try:
|
|
90
|
+
show_tip_if_available(args.command)
|
|
91
|
+
except Exception: # noqa: BLE001
|
|
92
|
+
logger.debug("Discovery tip not available")
|
|
93
|
+
|
|
94
|
+
return result if result is not None else 0
|
|
95
|
+
|
|
96
|
+
except KeyboardInterrupt:
|
|
97
|
+
print("\n\n⚠️ Interrupted by user")
|
|
98
|
+
return 130
|
|
99
|
+
|
|
100
|
+
except Exception as e: # noqa: BLE001
|
|
101
|
+
logger.exception(f"Unexpected error in command {args.command}")
|
|
102
|
+
print(f"\n❌ Error: {e}")
|
|
103
|
+
return 1
|
|
104
|
+
|
|
105
|
+
# No command specified
|
|
106
|
+
parser.print_help()
|
|
107
|
+
return 0
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def _register_legacy_commands(subparsers, old_cli):
|
|
111
|
+
"""Temporarily register commands not yet extracted from old cli.py.
|
|
112
|
+
|
|
113
|
+
This function provides backward compatibility during the refactoring process.
|
|
114
|
+
As commands are extracted into the new structure, they should be removed
|
|
115
|
+
from this registration.
|
|
116
|
+
|
|
117
|
+
Args:
|
|
118
|
+
subparsers: ArgumentParser subparsers object
|
|
119
|
+
old_cli: Reference to old cli module
|
|
120
|
+
|
|
121
|
+
Note:
|
|
122
|
+
This is a TEMPORARY function that will be removed once all commands
|
|
123
|
+
are extracted from the monolithic cli.py file.
|
|
124
|
+
"""
|
|
125
|
+
# Import command functions that haven't been extracted yet
|
|
126
|
+
try:
|
|
127
|
+
# Patterns commands
|
|
128
|
+
from empathy_os.cli import cmd_patterns_export, cmd_patterns_list, cmd_patterns_resolve
|
|
129
|
+
|
|
130
|
+
patterns_parser = subparsers.add_parser("patterns", help="Pattern management")
|
|
131
|
+
patterns_sub = patterns_parser.add_subparsers(dest="patterns_command")
|
|
246
132
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
from empathy_os.meta_workflows.cli_meta_workflows import meta_workflow_app
|
|
133
|
+
p_list = patterns_sub.add_parser("list", help="List patterns")
|
|
134
|
+
p_list.set_defaults(func=cmd_patterns_list)
|
|
250
135
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
136
|
+
p_export = patterns_sub.add_parser("export", help="Export patterns")
|
|
137
|
+
p_export.add_argument("output", help="Output file")
|
|
138
|
+
p_export.set_defaults(func=cmd_patterns_export)
|
|
254
139
|
|
|
140
|
+
p_resolve = patterns_sub.add_parser("resolve", help="Resolve pattern")
|
|
141
|
+
p_resolve.add_argument("pattern_id", help="Pattern ID")
|
|
142
|
+
p_resolve.set_defaults(func=cmd_patterns_resolve)
|
|
143
|
+
except (ImportError, AttributeError):
|
|
144
|
+
pass # Commands not available
|
|
255
145
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
app()
|
|
146
|
+
# Add other legacy commands as needed...
|
|
147
|
+
# This list will shrink as commands are extracted
|
|
259
148
|
|
|
260
149
|
|
|
150
|
+
# Preserve backward compatibility
|
|
261
151
|
if __name__ == "__main__":
|
|
262
|
-
main()
|
|
152
|
+
sys.exit(main())
|
empathy_os/cli/__main__.py
CHANGED
|
@@ -1,40 +1,12 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""CLI entry point for python -m empathy_os.cli execution.
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Legacy commands fall back to cli.py for compatibility.
|
|
3
|
+
Copyright 2025 Smart-AI-Memory
|
|
4
|
+
Licensed under Fair Source License 0.9
|
|
6
5
|
"""
|
|
7
6
|
|
|
8
7
|
import sys
|
|
9
|
-
from pathlib import Path
|
|
10
|
-
|
|
11
|
-
# Commands that are only in the new Typer CLI
|
|
12
|
-
NEW_CLI_COMMANDS = {"profile", "memory", "provider"}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def main() -> None:
|
|
16
|
-
"""Route to appropriate CLI based on command."""
|
|
17
|
-
# Check if we should use the new Typer CLI
|
|
18
|
-
if len(sys.argv) > 1 and sys.argv[1] in NEW_CLI_COMMANDS:
|
|
19
|
-
# Use the new Typer-based CLI
|
|
20
|
-
from empathy_os.cli import app
|
|
21
|
-
|
|
22
|
-
app()
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
# Fall back to legacy CLI for backward compatibility
|
|
26
|
-
parent = Path(__file__).parent.parent
|
|
27
|
-
if str(parent) not in sys.path:
|
|
28
|
-
sys.path.insert(0, str(parent))
|
|
29
|
-
|
|
30
|
-
import importlib.util
|
|
31
|
-
|
|
32
|
-
cli_py_path = parent / "cli.py"
|
|
33
|
-
spec = importlib.util.spec_from_file_location("cli_legacy", cli_py_path)
|
|
34
|
-
cli_module = importlib.util.module_from_spec(spec)
|
|
35
|
-
spec.loader.exec_module(cli_module)
|
|
36
|
-
cli_module.main()
|
|
37
8
|
|
|
9
|
+
from . import main
|
|
38
10
|
|
|
39
11
|
if __name__ == "__main__":
|
|
40
|
-
main()
|
|
12
|
+
sys.exit(main())
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
"""CLI command
|
|
2
|
-
|
|
3
|
-
Each module contains a Typer app that can be registered with the main app.
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
|
-
from empathy_os.cli.commands import inspection, memory, provider, utilities
|
|
7
|
-
|
|
8
|
-
__all__ = ["memory", "provider", "inspection", "utilities"]
|
|
1
|
+
"""CLI command implementations."""
|