higpertext-cli 0.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.
- config/adapters_config.json +450 -0
- config/antigravity_agent_template.json +31 -0
- config/app_config.json +174 -0
- config/context_engine.json +33 -0
- config/environments/model_defaults.json +5 -0
- config/governance/branching_strategy.json +36 -0
- config/governance/deployment_gates.json +30 -0
- config/governance/guidelines_contract.json +54 -0
- config/governance/quality_gates.json +39 -0
- config/governance/section_rules.json +22 -0
- config/governance/security_guardrails.json +52 -0
- config/hooks/README.md +35 -0
- config/hooks/custom/test_output_limiter.json +9 -0
- config/hooks/global/session_prompt.json +9 -0
- config/htx_config.json +24 -0
- config/profile_learner.json +18 -0
- config/profiles/base_agent.json +40 -0
- config/profiles/base_auditor.json +19 -0
- config/profiles/base_developer.json +19 -0
- config/profiles/base_operator.json +16 -0
- config/profiles/global.json +33 -0
- config/profiles/software_developer.json +23 -0
- config/router_content.json +137 -0
- config/semantic_graph.json +66 -0
- config/workflows/ado_release_flow.json +38 -0
- config/workflows/docs-update.json +33 -0
- config/workflows/governance-check.yaml +26 -0
- config/workflows/guidelines-sync.json +40 -0
- config/workflows/higpertext-build.json +73 -0
- config/workflows/higpertext-plan.json +38 -0
- config/workflows/higpertext-review.json +41 -0
- config/workflows/pr-quality-check.json +56 -0
- config/workflows/quality-remediation.json +57 -0
- higpertext/__init__.py +18 -0
- higpertext/adapters/__init__.py +27 -0
- higpertext/adapters/adapter_utils.py +604 -0
- higpertext/adapters/claude_adapter/__init__.py +0 -0
- higpertext/adapters/claude_adapter/claude_adapter.py +154 -0
- higpertext/adapters/copilot_adapter/__init__.py +0 -0
- higpertext/adapters/copilot_adapter/copilot_adapter.py +231 -0
- higpertext/adapters/gemini_adapter/__init__.py +0 -0
- higpertext/adapters/gemini_adapter/gemini_adapter.py +211 -0
- higpertext/adapters/llm_formatter.py +46 -0
- higpertext/adapters/open_code_adapter/__init__.py +0 -0
- higpertext/adapters/open_code_adapter/open_code_adapter.py +480 -0
- higpertext/capabilities/capabilities_runner.py +216 -0
- higpertext/capabilities/common/agent-builder.json +54 -0
- higpertext/capabilities/common/agent-sync.json +34 -0
- higpertext/capabilities/common/code-skeletonizer.json +35 -0
- higpertext/capabilities/common/commit-report.json +42 -0
- higpertext/capabilities/common/context-assembler.json +37 -0
- higpertext/capabilities/common/context-budget-report.json +15 -0
- higpertext/capabilities/common/dep-manager.json +43 -0
- higpertext/capabilities/common/docs-sync.json +14 -0
- higpertext/capabilities/common/doctor.json +18 -0
- higpertext/capabilities/common/efficiency-meter.json +31 -0
- higpertext/capabilities/common/env-catalog.json +13 -0
- higpertext/capabilities/common/env-clean.json +14 -0
- higpertext/capabilities/common/env-logs.json +16 -0
- higpertext/capabilities/common/env-runner.json +23 -0
- higpertext/capabilities/common/env-status.json +13 -0
- higpertext/capabilities/common/env-stop.json +14 -0
- higpertext/capabilities/common/env-template.json +14 -0
- higpertext/capabilities/common/error-context-locator.json +23 -0
- higpertext/capabilities/common/eval-agent.json +33 -0
- higpertext/capabilities/common/file-map.json +17 -0
- higpertext/capabilities/common/governance-exception.json +54 -0
- higpertext/capabilities/common/graph-query.json +59 -0
- higpertext/capabilities/common/graph-rebuild.json +31 -0
- higpertext/capabilities/common/graph-visualize.json +37 -0
- higpertext/capabilities/common/grep-search.json +176 -0
- higpertext/capabilities/common/higpertext-tester.json +25 -0
- higpertext/capabilities/common/hook-health.json +19 -0
- higpertext/capabilities/common/hook-sync-check.json +19 -0
- higpertext/capabilities/common/hooks-manager.json +55 -0
- higpertext/capabilities/common/knowledge-asker.json +27 -0
- higpertext/capabilities/common/list-rules.json +27 -0
- higpertext/capabilities/common/llm-invoke.json +59 -0
- higpertext/capabilities/common/load-rules.json +37 -0
- higpertext/capabilities/common/memory-manager.json +65 -0
- higpertext/capabilities/common/quality-scan.json +21 -0
- higpertext/capabilities/common/quality-updater.json +35 -0
- higpertext/capabilities/common/rag-index.json +17 -0
- higpertext/capabilities/common/report-viewer.json +24 -0
- higpertext/capabilities/common/roadmap-report.json +37 -0
- higpertext/capabilities/common/scripts/_env_cli.py +65 -0
- higpertext/capabilities/common/scripts/agent_builder.py +60 -0
- higpertext/capabilities/common/scripts/agent_sync.py +56 -0
- higpertext/capabilities/common/scripts/ask_higpertext.py +38 -0
- higpertext/capabilities/common/scripts/code_skeletonizer.py +225 -0
- higpertext/capabilities/common/scripts/commit_report.py +134 -0
- higpertext/capabilities/common/scripts/context_assembler.py +70 -0
- higpertext/capabilities/common/scripts/context_budget_report.py +53 -0
- higpertext/capabilities/common/scripts/dep_manager.py +81 -0
- higpertext/capabilities/common/scripts/docs_sync.py +981 -0
- higpertext/capabilities/common/scripts/doctor.py +144 -0
- higpertext/capabilities/common/scripts/efficiency_meter.py +83 -0
- higpertext/capabilities/common/scripts/env_catalog.py +47 -0
- higpertext/capabilities/common/scripts/env_clean.py +30 -0
- higpertext/capabilities/common/scripts/env_logs.py +32 -0
- higpertext/capabilities/common/scripts/env_runner.py +53 -0
- higpertext/capabilities/common/scripts/env_status.py +38 -0
- higpertext/capabilities/common/scripts/env_stop.py +30 -0
- higpertext/capabilities/common/scripts/env_template.py +73 -0
- higpertext/capabilities/common/scripts/error_context_locator.py +138 -0
- higpertext/capabilities/common/scripts/eval_agent.py +80 -0
- higpertext/capabilities/common/scripts/file_map.py +95 -0
- higpertext/capabilities/common/scripts/governance_exception.py +116 -0
- higpertext/capabilities/common/scripts/graph_query.py +104 -0
- higpertext/capabilities/common/scripts/graph_rebuild.py +107 -0
- higpertext/capabilities/common/scripts/graph_visualize.py +76 -0
- higpertext/capabilities/common/scripts/grep_search.py +648 -0
- higpertext/capabilities/common/scripts/higpertext_tester.py +102 -0
- higpertext/capabilities/common/scripts/hook_health.py +149 -0
- higpertext/capabilities/common/scripts/hook_sync_check.py +134 -0
- higpertext/capabilities/common/scripts/hooks_manager.py +171 -0
- higpertext/capabilities/common/scripts/list_rules.py +175 -0
- higpertext/capabilities/common/scripts/llm_invoke.py +135 -0
- higpertext/capabilities/common/scripts/load_rules.py +379 -0
- higpertext/capabilities/common/scripts/memory_manager.py +210 -0
- higpertext/capabilities/common/scripts/presentation_engine.py +63 -0
- higpertext/capabilities/common/scripts/quality_scan.py +132 -0
- higpertext/capabilities/common/scripts/rag_index.py +39 -0
- higpertext/capabilities/common/scripts/report_viewer.py +106 -0
- higpertext/capabilities/common/scripts/roadmap_report.py +73 -0
- higpertext/capabilities/common/scripts/search_router.py +111 -0
- higpertext/capabilities/common/scripts/semantic_diff.py +166 -0
- higpertext/capabilities/common/scripts/semantic_search.py +43 -0
- higpertext/capabilities/common/scripts/session_control.py +136 -0
- higpertext/capabilities/common/scripts/smart_read.py +232 -0
- higpertext/capabilities/common/scripts/subagent_executor.py +143 -0
- higpertext/capabilities/common/scripts/sync_agents.py +353 -0
- higpertext/capabilities/common/scripts/task_decomposer.py +78 -0
- higpertext/capabilities/common/scripts/telemetry_report.py +36 -0
- higpertext/capabilities/common/search-router.json +24 -0
- higpertext/capabilities/common/semantic-diff.json +40 -0
- higpertext/capabilities/common/semantic-search.json +19 -0
- higpertext/capabilities/common/session-clean.json +20 -0
- higpertext/capabilities/common/session-start.json +44 -0
- higpertext/capabilities/common/smart-read.json +28 -0
- higpertext/capabilities/common/subagent-executor.json +25 -0
- higpertext/capabilities/common/sync-agents.json +32 -0
- higpertext/capabilities/common/task-decomposer.json +37 -0
- higpertext/capabilities/common/telemetry-report.json +23 -0
- higpertext/capabilities/git/__init__.py +0 -0
- higpertext/capabilities/git/committer.json +61 -0
- higpertext/capabilities/git/diff.json +33 -0
- higpertext/capabilities/git/ls-files.json +44 -0
- higpertext/capabilities/git/rm.json +27 -0
- higpertext/capabilities/git/scripts/__init__.py +0 -0
- higpertext/capabilities/git/scripts/commit_changes.py +1077 -0
- higpertext/capabilities/git/scripts/git_diff.py +171 -0
- higpertext/capabilities/git/scripts/git_ls_files.py +376 -0
- higpertext/capabilities/git/scripts/git_rm.py +62 -0
- higpertext/capabilities/security/k8s-auditor.json +33 -0
- higpertext/capabilities/security/scripts/k8s_auditor.py +307 -0
- higpertext/capabilities/security/scripts/secret_scanner.py +235 -0
- higpertext/capabilities/security/secret-scanner.json +32 -0
- higpertext/hooks/__init__.py +28 -0
- higpertext/hooks/_compat.py +27 -0
- higpertext/hooks/hook_tasks/__init__.py +1 -0
- higpertext/hooks/hook_tasks/_rules/__init__.py +0 -0
- higpertext/hooks/hook_tasks/_rules/bash_rules.py +635 -0
- higpertext/hooks/hook_tasks/_rules/context_engine_rule.py +79 -0
- higpertext/hooks/hook_tasks/_rules/context_rules.py +199 -0
- higpertext/hooks/hook_tasks/_rules/governance_adapter.py +72 -0
- higpertext/hooks/hook_tasks/_rules/profile_rules.json +25 -0
- higpertext/hooks/hook_tasks/_rules/quality_rules.py +86 -0
- higpertext/hooks/hook_tasks/_rules/security_rules.py +214 -0
- higpertext/hooks/hook_tasks/_rules/session_rules.py +316 -0
- higpertext/hooks/hook_tasks/_rules/telemetry_rules.py +121 -0
- higpertext/hooks/hook_tasks/audit_logger_hook.py +28 -0
- higpertext/hooks/hook_tasks/hook_bash_guard.py +101 -0
- higpertext/hooks/hook_tasks/hook_code_quality.py +48 -0
- higpertext/hooks/hook_tasks/hook_context_hint.py +46 -0
- higpertext/hooks/hook_tasks/hook_context_manager.py +44 -0
- higpertext/hooks/hook_tasks/hook_io.py +122 -0
- higpertext/hooks/hook_tasks/hook_loop_guard.py +182 -0
- higpertext/hooks/hook_tasks/hook_post_observer.py +54 -0
- higpertext/hooks/hook_tasks/hook_read_guard.py +85 -0
- higpertext/hooks/hook_tasks/hook_security_guard.py +81 -0
- higpertext/hooks/hook_tasks/hook_session_prompt.py +83 -0
- higpertext/hooks/hook_tasks/hook_session_stop.py +115 -0
- higpertext/hooks/hook_tasks/hook_utils.py +144 -0
- higpertext/hooks/hook_tasks/session_guard_hook.py +23 -0
- higpertext/hooks/hook_tasks/telemetry_utils.py +176 -0
- higpertext/hooks/hook_tasks/test_echo_hook.py +33 -0
- higpertext/hooks/hook_tasks/webhook_hook.py +54 -0
- higpertext/hooks/hook_tasks/workflow_runner_hook.py +49 -0
- higpertext/hooks/hooks_catalog.json +116 -0
- higpertext/kernel/__init__.py +63 -0
- higpertext/kernel/_compat.py +138 -0
- higpertext/kernel/app_config.py +117 -0
- higpertext/kernel/application/__init__.py +13 -0
- higpertext/kernel/application/agent_registry.py +102 -0
- higpertext/kernel/application/capability_manager.py +61 -0
- higpertext/kernel/application/commit_reporter.py +247 -0
- higpertext/kernel/application/context_builder.py +166 -0
- higpertext/kernel/application/context_engine.py +409 -0
- higpertext/kernel/application/engine.py +41 -0
- higpertext/kernel/application/env_runtime.py +174 -0
- higpertext/kernel/application/environment_manager.py +154 -0
- higpertext/kernel/application/governance.py +192 -0
- higpertext/kernel/application/hook_registry.py +102 -0
- higpertext/kernel/application/hook_renderer.py +720 -0
- higpertext/kernel/application/ports.py +49 -0
- higpertext/kernel/application/profile_learner.py +358 -0
- higpertext/kernel/application/profile_service.py +205 -0
- higpertext/kernel/application/profile_services.py +6 -0
- higpertext/kernel/application/profile_use_cases.py +93 -0
- higpertext/kernel/application/rag_service.py +75 -0
- higpertext/kernel/application/roadmap_reporter.py +178 -0
- higpertext/kernel/application/semantic_engine.py +258 -0
- higpertext/kernel/application/session_services.py +33 -0
- higpertext/kernel/application/skill_hook_compiler.py +85 -0
- higpertext/kernel/application/telemetry.py +326 -0
- higpertext/kernel/application/workflow_manager.py +176 -0
- higpertext/kernel/config_paths.py +66 -0
- higpertext/kernel/domain/__init__.py +12 -0
- higpertext/kernel/domain/agent_registry.py +23 -0
- higpertext/kernel/domain/commit_reporter.py +155 -0
- higpertext/kernel/domain/compilers.py +7 -0
- higpertext/kernel/domain/context_engine.py +319 -0
- higpertext/kernel/domain/entities.py +51 -0
- higpertext/kernel/domain/env_runtime.py +62 -0
- higpertext/kernel/domain/governance.py +198 -0
- higpertext/kernel/domain/hook_models.py +29 -0
- higpertext/kernel/domain/profile_learner.py +186 -0
- higpertext/kernel/domain/rag.py +70 -0
- higpertext/kernel/domain/repositories.py +8 -0
- higpertext/kernel/domain/roadmap_reporter.py +80 -0
- higpertext/kernel/domain/semantic_engine.py +107 -0
- higpertext/kernel/engine.py +42 -0
- higpertext/kernel/htx_resolver.py +69 -0
- higpertext/kernel/infrastructure/__init__.py +13 -0
- higpertext/kernel/infrastructure/agent_registry.py +40 -0
- higpertext/kernel/infrastructure/cache/capability_cache.py +319 -0
- higpertext/kernel/infrastructure/capability_helper.py +40 -0
- higpertext/kernel/infrastructure/cli/__init__.py +1 -0
- higpertext/kernel/infrastructure/cli/agent_commands.py +62 -0
- higpertext/kernel/infrastructure/cli/arguments.py +39 -0
- higpertext/kernel/infrastructure/cli/capability_command_builder.py +86 -0
- higpertext/kernel/infrastructure/cli/capability_task_service.py +234 -0
- higpertext/kernel/infrastructure/cli/cli_search.py +234 -0
- higpertext/kernel/infrastructure/cli/parameter_contracts.py +83 -0
- higpertext/kernel/infrastructure/cli/parser_builder.py +122 -0
- higpertext/kernel/infrastructure/cli/profile_commands.py +89 -0
- higpertext/kernel/infrastructure/cli/roadmap_commands.py +117 -0
- higpertext/kernel/infrastructure/cli/router.py +1110 -0
- higpertext/kernel/infrastructure/cli/session_commands.py +36 -0
- higpertext/kernel/infrastructure/cli/task_commands.py +23 -0
- higpertext/kernel/infrastructure/cli/task_result_reporter.py +56 -0
- higpertext/kernel/infrastructure/cli/workflow_commands.py +25 -0
- higpertext/kernel/infrastructure/compilers/__init__.py +3 -0
- higpertext/kernel/infrastructure/compilers/factory.py +27 -0
- higpertext/kernel/infrastructure/compilers/graph_compiler.py +20 -0
- higpertext/kernel/infrastructure/compilers/guide_compiler.py +50 -0
- higpertext/kernel/infrastructure/compilers/hook_compiler.py +69 -0
- higpertext/kernel/infrastructure/compilers/playbook_compiler.py +154 -0
- higpertext/kernel/infrastructure/context_engine.py +303 -0
- higpertext/kernel/infrastructure/database/local_vector_store.py +99 -0
- higpertext/kernel/infrastructure/deployment/__init__.py +1 -0
- higpertext/kernel/infrastructure/deployment/resource_deployer.py +283 -0
- higpertext/kernel/infrastructure/diagnostics/__init__.py +1 -0
- higpertext/kernel/infrastructure/diagnostics/health.py +191 -0
- higpertext/kernel/infrastructure/env_runtime.py +227 -0
- higpertext/kernel/infrastructure/execution/__init__.py +1 -0
- higpertext/kernel/infrastructure/execution/parallel.py +188 -0
- higpertext/kernel/infrastructure/execution/resilience.py +155 -0
- higpertext/kernel/infrastructure/file_repositories.py +213 -0
- higpertext/kernel/infrastructure/governance.py +198 -0
- higpertext/kernel/infrastructure/hook_config_loader.py +53 -0
- higpertext/kernel/infrastructure/hook_webhook_dispatcher.py +61 -0
- higpertext/kernel/infrastructure/hook_workflow_bridge.py +60 -0
- higpertext/kernel/infrastructure/llm/__init__.py +6 -0
- higpertext/kernel/infrastructure/llm/provider.py +46 -0
- higpertext/kernel/infrastructure/llm/providers/__init__.py +0 -0
- higpertext/kernel/infrastructure/llm/providers/anthropic_provider.py +94 -0
- higpertext/kernel/infrastructure/llm/providers/gemini_embeddings.py +74 -0
- higpertext/kernel/infrastructure/llm/providers/gemini_provider.py +101 -0
- higpertext/kernel/infrastructure/llm/providers/ollama_provider.py +110 -0
- higpertext/kernel/infrastructure/llm/providers/openai_provider.py +98 -0
- higpertext/kernel/infrastructure/llm/registry.py +81 -0
- higpertext/kernel/infrastructure/logger.py +303 -0
- higpertext/kernel/infrastructure/output_store.py +70 -0
- higpertext/kernel/infrastructure/parser/__init__.py +1 -0
- higpertext/kernel/infrastructure/parser/code_chunker.py +144 -0
- higpertext/kernel/infrastructure/parser/language/__init__.py +14 -0
- higpertext/kernel/infrastructure/parser/language/base.py +41 -0
- higpertext/kernel/infrastructure/parser/language/powershell_parser.py +35 -0
- higpertext/kernel/infrastructure/parser/language/python_parser.py +98 -0
- higpertext/kernel/infrastructure/parser/language/typescript_parser.py +91 -0
- higpertext/kernel/infrastructure/parser/semantic_graph.py +409 -0
- higpertext/kernel/infrastructure/presentation/__init__.py +1 -0
- higpertext/kernel/infrastructure/presentation/html_renderer.py +137 -0
- higpertext/kernel/infrastructure/presentation/markdown_renderer.py +84 -0
- higpertext/kernel/infrastructure/presentation/markdown_report_renderer.py +97 -0
- higpertext/kernel/infrastructure/profile_store.py +28 -0
- higpertext/kernel/infrastructure/semantic_engine.py +289 -0
- higpertext/kernel/infrastructure/telemetry_reporter.py +132 -0
- higpertext/kernel/infrastructure/validation/__init__.py +1 -0
- higpertext/kernel/infrastructure/validation/contract_validator.py +163 -0
- higpertext/kernel/pkg_resources.py +38 -0
- higpertext/kernel/session_manager.py +319 -0
- higpertext/templates/env/generic-shell.yaml +21 -0
- higpertext/templates/env/node-vitest.yaml +27 -0
- higpertext/templates/env/python-pytest.yaml +29 -0
- higpertext/templates/html/commit_body.html +20 -0
- higpertext/templates/html/commit_diff.html +4 -0
- higpertext/templates/html/commit_index.html +29 -0
- higpertext/templates/html/commit_layer.html +11 -0
- higpertext/templates/html/commit_shell.html +28 -0
- higpertext/templates/html/graph_visualize.html +86 -0
- higpertext/templates/html/roadmap_body.html +12 -0
- higpertext/templates/html/roadmap_phase.html +5 -0
- higpertext/templates/html/roadmap_shell.html +29 -0
- higpertext/templates/markdown/commit_report.md +18 -0
- higpertext/templates/markdown/efficiency_report.md +12 -0
- higpertext/templates/markdown/roadmap_report.md +25 -0
- higpertext/templates/skills/best-practices.md +7 -0
- higpertext/templates/skills/clean-code.md +8 -0
- higpertext/templates/skills/ddd-standards.md +7 -0
- higpertext/templates/skills/tdd-practices.md +7 -0
- higpertext/templates/subagents/architect.md +7 -0
- higpertext/templates/subagents/test-engineer.md +7 -0
- higpertext/templates/workflows/build.json +23 -0
- higpertext/templates/workflows/compact.json +21 -0
- higpertext/templates/workflows/plan.json +59 -0
- higpertext/templates/workflows/review.json +26 -0
- higpertext/templates/workflows/spec.json +27 -0
- higpertext_cli-0.8.0.dist-info/METADATA +35 -0
- higpertext_cli-0.8.0.dist-info/RECORD +335 -0
- higpertext_cli-0.8.0.dist-info/WHEEL +5 -0
- higpertext_cli-0.8.0.dist-info/entry_points.txt +2 -0
- higpertext_cli-0.8.0.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"""Constructor de parser para el CLI de higpertext."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def add_task_ask_subparsers(subs: argparse.Action) -> None:
|
|
9
|
+
task_p = subs.add_parser("task", help="Ejecutar una tarea técnica")
|
|
10
|
+
task_p.add_argument("name", help="Nombre de la tarea")
|
|
11
|
+
task_p.add_argument("task_args", nargs=argparse.REMAINDER)
|
|
12
|
+
task_p.add_argument(
|
|
13
|
+
"--stream",
|
|
14
|
+
action="store_true",
|
|
15
|
+
default=False,
|
|
16
|
+
help="Activar streaming de output en tiempo real",
|
|
17
|
+
)
|
|
18
|
+
task_p.add_argument(
|
|
19
|
+
"--no-cache",
|
|
20
|
+
dest="no_cache",
|
|
21
|
+
action="store_true",
|
|
22
|
+
default=False,
|
|
23
|
+
help="Forzar ejecución ignorando el cache",
|
|
24
|
+
)
|
|
25
|
+
ask_p = subs.add_parser("ask", help="Consultar base de conocimiento")
|
|
26
|
+
ask_p.add_argument("query")
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def add_profile_init_subparsers(subs: argparse.Action, assistants: list[str]) -> None:
|
|
30
|
+
prof_p = subs.add_parser("profile", help="Gestionar perfiles de agentes")
|
|
31
|
+
prof_p.add_argument("action", choices=["load", "learn", "validate", "install"])
|
|
32
|
+
prof_p.add_argument("--source", default=None, help="Path al repo externo del perfil")
|
|
33
|
+
prof_p.add_argument("name", nargs="?")
|
|
34
|
+
prof_p.add_argument("--assistant", choices=assistants, default=None)
|
|
35
|
+
|
|
36
|
+
prof_p.add_argument("--target")
|
|
37
|
+
init_p = subs.add_parser("init", help="Inicializar proyecto para asistente")
|
|
38
|
+
init_p.add_argument("profile", nargs="?")
|
|
39
|
+
init_p.add_argument("--assistant", choices=assistants + ["agent"], required=True)
|
|
40
|
+
init_p.add_argument("--target")
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def add_session_workflow_subparsers(subs: argparse.Action, assistants: list[str]) -> None:
|
|
44
|
+
sess_p = subs.add_parser("session", help="Gestionar sesiones temporales")
|
|
45
|
+
sess_p.add_argument("action", choices=["start", "clean"])
|
|
46
|
+
sess_p.add_argument("--profile")
|
|
47
|
+
sess_p.add_argument("--assistant", choices=assistants)
|
|
48
|
+
sess_p.add_argument("--skills")
|
|
49
|
+
sess_p.add_argument("--subagents")
|
|
50
|
+
wf_p = subs.add_parser("workflow", help="Ejecutar flujos de trabajo")
|
|
51
|
+
wf_subs = wf_p.add_subparsers(dest="workflow_action")
|
|
52
|
+
run_p = wf_subs.add_parser("run")
|
|
53
|
+
run_p.add_argument("name")
|
|
54
|
+
run_p.add_argument("wf_args", nargs=argparse.REMAINDER)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def add_health_subparser(subs: argparse.Action) -> None:
|
|
58
|
+
health_p = subs.add_parser("health", help="Verificar integridad del motor (< 2s)")
|
|
59
|
+
health_p.add_argument(
|
|
60
|
+
"--verbose",
|
|
61
|
+
action="store_true",
|
|
62
|
+
default=False,
|
|
63
|
+
help="Mostrar advertencias detalladas",
|
|
64
|
+
)
|
|
65
|
+
doctor_p = subs.add_parser("doctor", help="Diagnóstico integral del workspace higpertext")
|
|
66
|
+
doctor_p.add_argument("--json", action="store_true", default=False)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def add_agent_subparser(subs: argparse.Action) -> None:
|
|
70
|
+
agent_p = subs.add_parser("agent", help="Gestionar agentes higpertext sin asistente")
|
|
71
|
+
agent_subs = agent_p.add_subparsers(dest="agent_action")
|
|
72
|
+
|
|
73
|
+
init_p = agent_subs.add_parser("init", help="Inicializar ambiente de agente")
|
|
74
|
+
init_p.add_argument("--profile", required=True, help="Perfil a activar")
|
|
75
|
+
init_p.add_argument("--target", default=None, help="Directorio destino (default: cwd)")
|
|
76
|
+
|
|
77
|
+
status_p = agent_subs.add_parser("status", help="Estado del ambiente del agente")
|
|
78
|
+
status_p.add_argument("--target", default=None)
|
|
79
|
+
|
|
80
|
+
clean_p = agent_subs.add_parser("clean", help="Limpiar ambiente efímero del agente")
|
|
81
|
+
clean_p.add_argument("--target", default=None)
|
|
82
|
+
|
|
83
|
+
reg_p = agent_subs.add_parser("register", help="Registrar agente externo en el motor")
|
|
84
|
+
reg_p.add_argument("--name", required=True, help="Nombre del agente")
|
|
85
|
+
reg_p.add_argument("--path", required=True, help="Ruta absoluta al proyecto del agente")
|
|
86
|
+
reg_p.add_argument("--profile", required=True, help="Perfil activo del agente")
|
|
87
|
+
|
|
88
|
+
sync_p = agent_subs.add_parser("sync", help="Sincronizar hooks y perfil hacia agentes registrados")
|
|
89
|
+
sync_p.add_argument("--name", default=None, help="Sincronizar solo este agente (default: todos)")
|
|
90
|
+
sync_p.add_argument("--assistant", default="claude", help="Asistente objetivo")
|
|
91
|
+
|
|
92
|
+
agent_subs.add_parser("list", help="Listar agentes externos registrados")
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def add_roadmap_subparser(subs: argparse.Action) -> None:
|
|
96
|
+
rm_p = subs.add_parser("roadmap", help="Gestionar roadmaps del proyecto")
|
|
97
|
+
rm_subs = rm_p.add_subparsers(dest="roadmap_action")
|
|
98
|
+
|
|
99
|
+
add_p = rm_subs.add_parser("add", help="Activar un roadmap existente")
|
|
100
|
+
add_p.add_argument("id", help="ID del roadmap (nombre del archivo sin .json)")
|
|
101
|
+
|
|
102
|
+
rm_subs.add_parser("list", help="Listar roadmaps activos e inactivos")
|
|
103
|
+
|
|
104
|
+
rm_p2 = rm_subs.add_parser("remove", help="Desactivar un roadmap activo")
|
|
105
|
+
rm_p2.add_argument("id", help="ID del roadmap a desactivar")
|
|
106
|
+
|
|
107
|
+
new_p = rm_subs.add_parser("new", help="Crear un roadmap nuevo")
|
|
108
|
+
new_p.add_argument("id", help="ID del nuevo roadmap")
|
|
109
|
+
new_p.add_argument("--project", required=True, help="Nombre del proyecto")
|
|
110
|
+
new_p.add_argument("--description", default="", help="Descripción del roadmap")
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def build_parser(assistants: list[str]) -> argparse.ArgumentParser:
|
|
114
|
+
parser = argparse.ArgumentParser(description="higpertext Engine Orchestrator")
|
|
115
|
+
subs = parser.add_subparsers(dest="command")
|
|
116
|
+
add_task_ask_subparsers(subs)
|
|
117
|
+
add_profile_init_subparsers(subs, assistants)
|
|
118
|
+
add_session_workflow_subparsers(subs, assistants)
|
|
119
|
+
add_health_subparser(subs)
|
|
120
|
+
add_agent_subparser(subs)
|
|
121
|
+
add_roadmap_subparser(subs)
|
|
122
|
+
return parser
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"""Handlers CLI para gestión de perfiles."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def dispatch_profile(nexus, args: argparse.Namespace, logger, root_dir: Path) -> None:
|
|
10
|
+
action = getattr(args, "action", None)
|
|
11
|
+
handlers = {
|
|
12
|
+
"learn": lambda: dispatch_profile_learn(args, root_dir),
|
|
13
|
+
"validate": lambda: dispatch_profile_validate(nexus, args, logger),
|
|
14
|
+
"install": lambda: nexus.install_profile(args.name, args.target, getattr(args, "source", None)),
|
|
15
|
+
"load": lambda: nexus.load_agent_profile(args.name, args.assistant, args.target),
|
|
16
|
+
}
|
|
17
|
+
handlers.get(action, handlers["load"])()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def dispatch_profile_learn(args: argparse.Namespace, root_dir: Path) -> None:
|
|
21
|
+
"""Extrae patrones, calibra pesos y actualiza learned_profile.json."""
|
|
22
|
+
from higpertext.kernel.application.profile_learner import (
|
|
23
|
+
ProfileExtractor,
|
|
24
|
+
ProfileUpdater,
|
|
25
|
+
WeightsCalibrator,
|
|
26
|
+
)
|
|
27
|
+
from higpertext.kernel.infrastructure.profile_store import ProfileStore
|
|
28
|
+
from higpertext.kernel.infrastructure.logger import get_logger
|
|
29
|
+
|
|
30
|
+
log = get_logger(project_root=root_dir)
|
|
31
|
+
days = getattr(args, "days", 30)
|
|
32
|
+
log.info(f"Analizando últimos {days} días de telemetría…")
|
|
33
|
+
|
|
34
|
+
extractor = ProfileExtractor(root_dir)
|
|
35
|
+
fresh, patterns = extractor.extract(days=days)
|
|
36
|
+
|
|
37
|
+
pattern_count = len(patterns)
|
|
38
|
+
calibrator = WeightsCalibrator(root_dir)
|
|
39
|
+
calibrator.calibrate(patterns)
|
|
40
|
+
|
|
41
|
+
if pattern_count >= 20:
|
|
42
|
+
calibration_mode = "regresión lineal"
|
|
43
|
+
elif pattern_count >= 10:
|
|
44
|
+
calibration_mode = "z-score"
|
|
45
|
+
else:
|
|
46
|
+
calibration_mode = f"defaults (faltan {10 - pattern_count} sesiones para z-score)"
|
|
47
|
+
|
|
48
|
+
store = ProfileStore(root_dir)
|
|
49
|
+
existing = store.load()
|
|
50
|
+
updater = ProfileUpdater()
|
|
51
|
+
merged = updater.merge(existing, fresh)
|
|
52
|
+
store.save(merged)
|
|
53
|
+
|
|
54
|
+
log.event_block(
|
|
55
|
+
"profile-learn",
|
|
56
|
+
status="ok",
|
|
57
|
+
fields={
|
|
58
|
+
"sessions_analyzed": pattern_count,
|
|
59
|
+
"calibration_mode": calibration_mode,
|
|
60
|
+
"adoption_pct": f"{fresh.higpertext_adoption_trend}%",
|
|
61
|
+
"strong_patterns": ", ".join(fresh.strong_patterns) or None,
|
|
62
|
+
"weak_patterns": ", ".join(fresh.weak_patterns) or None,
|
|
63
|
+
"commit_topics": ", ".join(fresh.commit_topics) or None,
|
|
64
|
+
"output": ".higpertext/state/learned_profile.json",
|
|
65
|
+
},
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def dispatch_profile_validate(nexus, args: argparse.Namespace, logger) -> None:
|
|
70
|
+
if not args.name:
|
|
71
|
+
logger.warning("[!] Especifica el nombre del perfil a validar (ej: software_developer).")
|
|
72
|
+
return
|
|
73
|
+
success, errors, warnings = nexus.engine.validate_profile(args.name)
|
|
74
|
+
if success:
|
|
75
|
+
logger.ok(
|
|
76
|
+
f"[SUCCESS] El perfil '{args.name}' es válido y cumple con todas las dependencias e integridad."
|
|
77
|
+
)
|
|
78
|
+
if warnings:
|
|
79
|
+
logger.info(f"\n[*] ALERTA: Optimización del perfil '{args.name}':")
|
|
80
|
+
for warning in warnings:
|
|
81
|
+
logger.info(f" - {warning}")
|
|
82
|
+
else:
|
|
83
|
+
logger.warning(f"[!] El perfil '{args.name}' contiene errores de validación:")
|
|
84
|
+
for error in errors:
|
|
85
|
+
logger.info(f" - {error}")
|
|
86
|
+
if warnings:
|
|
87
|
+
logger.info(f"\n[*] ALERTA: Optimización del perfil '{args.name}':")
|
|
88
|
+
for warning in warnings:
|
|
89
|
+
logger.info(f" - {warning}")
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"""Handlers CLI para gestión de roadmaps."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
import json
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
from higpertext.kernel.config_paths import WORKSPACE_DIR_NAME
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def dispatch_roadmap(args: argparse.Namespace, logger, project_root: Path | None = None) -> None:
|
|
13
|
+
"""Gestiona roadmaps en .higpertext/config/roadmaps/."""
|
|
14
|
+
roadmaps_dir = (project_root or Path.cwd()) / WORKSPACE_DIR_NAME / "config" / "roadmaps"
|
|
15
|
+
roadmaps_dir.mkdir(parents=True, exist_ok=True)
|
|
16
|
+
active_index = roadmaps_dir / "active.json"
|
|
17
|
+
|
|
18
|
+
store = RoadmapCliStore(roadmaps_dir, active_index)
|
|
19
|
+
action = getattr(args, "roadmap_action", None)
|
|
20
|
+
|
|
21
|
+
if action == "list":
|
|
22
|
+
_list_roadmaps(store, logger)
|
|
23
|
+
elif action == "add":
|
|
24
|
+
_add_roadmap(store, args.id, logger)
|
|
25
|
+
elif action == "remove":
|
|
26
|
+
_remove_roadmap(store, args.id, logger)
|
|
27
|
+
elif action == "new":
|
|
28
|
+
_new_roadmap(store, args.id, args.project, args.description, logger)
|
|
29
|
+
else:
|
|
30
|
+
logger.info("Uso: htx roadmap [list|add|remove|new]")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class RoadmapCliStore:
|
|
34
|
+
"""Persistencia mínima para el comando roadmap."""
|
|
35
|
+
|
|
36
|
+
def __init__(self, roadmaps_dir: Path, active_index: Path) -> None:
|
|
37
|
+
self.roadmaps_dir = roadmaps_dir
|
|
38
|
+
self.active_index = active_index
|
|
39
|
+
|
|
40
|
+
def load_active(self) -> list[str]:
|
|
41
|
+
try:
|
|
42
|
+
return json.loads(self.active_index.read_text(encoding="utf-8")).get("active", [])
|
|
43
|
+
except (OSError, json.JSONDecodeError):
|
|
44
|
+
return []
|
|
45
|
+
|
|
46
|
+
def save_active(self, ids: list[str]) -> None:
|
|
47
|
+
self.active_index.write_text(
|
|
48
|
+
json.dumps({"active": ids}, indent=2, ensure_ascii=False),
|
|
49
|
+
encoding="utf-8",
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
def roadmap_path(self, roadmap_id: str) -> Path:
|
|
53
|
+
return self.roadmaps_dir / f"{roadmap_id}.json"
|
|
54
|
+
|
|
55
|
+
def roadmap_ids(self) -> list[str]:
|
|
56
|
+
return sorted(f.stem for f in self.roadmaps_dir.glob("*.json") if f.stem != "active")
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _list_roadmaps(store: RoadmapCliStore, logger) -> None:
|
|
60
|
+
active = store.load_active()
|
|
61
|
+
logger.info("\n── Roadmaps ──────────────────────────────")
|
|
62
|
+
for roadmap_id in store.roadmap_ids():
|
|
63
|
+
marker = "● activo" if roadmap_id in active else "○ inactivo"
|
|
64
|
+
try:
|
|
65
|
+
data = json.loads(store.roadmap_path(roadmap_id).read_text(encoding="utf-8"))
|
|
66
|
+
project = data.get("project", roadmap_id)
|
|
67
|
+
phases_done = sum(1 for p in data.get("phases", []) if p.get("status") == "done")
|
|
68
|
+
phases_total = len(data.get("phases", []))
|
|
69
|
+
logger.info(f" {marker} {roadmap_id}")
|
|
70
|
+
logger.info(f" {project} [{phases_done}/{phases_total} fases]")
|
|
71
|
+
except (OSError, json.JSONDecodeError):
|
|
72
|
+
logger.error(f" {marker} {roadmap_id} (error al leer)")
|
|
73
|
+
logger.info("")
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def _add_roadmap(store: RoadmapCliStore, roadmap_id: str, logger) -> None:
|
|
77
|
+
if not store.roadmap_path(roadmap_id).exists():
|
|
78
|
+
logger.error(
|
|
79
|
+
f"[ERROR] No existe '{roadmap_id}.json' en roadmaps/. Créalo primero con 'roadmap new'."
|
|
80
|
+
)
|
|
81
|
+
return
|
|
82
|
+
active = store.load_active()
|
|
83
|
+
if roadmap_id in active:
|
|
84
|
+
logger.info(f"[*] '{roadmap_id}' ya está activo.")
|
|
85
|
+
return
|
|
86
|
+
active.append(roadmap_id)
|
|
87
|
+
store.save_active(active)
|
|
88
|
+
logger.ok(f"[SUCCESS] Roadmap '{roadmap_id}' activado. Activos: {active}")
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _remove_roadmap(store: RoadmapCliStore, roadmap_id: str, logger) -> None:
|
|
92
|
+
active = store.load_active()
|
|
93
|
+
if roadmap_id not in active:
|
|
94
|
+
logger.info(f"[*] '{roadmap_id}' no está en la lista activa.")
|
|
95
|
+
return
|
|
96
|
+
active.remove(roadmap_id)
|
|
97
|
+
store.save_active(active)
|
|
98
|
+
logger.ok(f"[SUCCESS] Roadmap '{roadmap_id}' desactivado. Activos: {active}")
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def _new_roadmap(
|
|
102
|
+
store: RoadmapCliStore, roadmap_id: str, project: str, description: str, logger
|
|
103
|
+
) -> None:
|
|
104
|
+
target = store.roadmap_path(roadmap_id)
|
|
105
|
+
if target.exists():
|
|
106
|
+
logger.error(f"[ERROR] Ya existe '{roadmap_id}.json'. Usa otro ID.")
|
|
107
|
+
return
|
|
108
|
+
template = {
|
|
109
|
+
"project": project,
|
|
110
|
+
"profile": "",
|
|
111
|
+
"description": description,
|
|
112
|
+
"phases": [],
|
|
113
|
+
"session_resources": {"skills": [], "subagents": []},
|
|
114
|
+
}
|
|
115
|
+
target.write_text(json.dumps(template, indent=2, ensure_ascii=False), encoding="utf-8")
|
|
116
|
+
logger.ok(f"[SUCCESS] Roadmap '{roadmap_id}' creado en {target}")
|
|
117
|
+
logger.info(f" Edítalo y actívalo con: htx roadmap add {roadmap_id}")
|