From a59f9c006b1799ce175eee07055432d7460dfacc Mon Sep 17 00:00:00 2001 From: AIOSAI Date: Fri, 6 Mar 2026 20:40:16 +0000 Subject: [PATCH] updates --- AI_CENTRAL/PLANS.central.json | 49 +++ ai_mail/logs/ai_mail.log | 35 ++ ai_mail/logs/dispatch.log | 1 + api/logs/api.log | 29 ++ flow/logs/aggregate_central.log | 6 + flow/logs/close_plan.log | 4 + flow/logs/create_plan.log | 2 + flow/logs/flow.log | 77 +++++ flow/logs/list_plans.log | 2 + notepad.md | 0 prax/logs/monitor_module.log | 2 + pyproject.toml | 4 +- seedgo/logs/seedgo_verify.log | 1 + seedgo/logs/standards_checklist.log | 78 +++++ src/aipass/ai_mail/README.md | 319 ++++++++++++++++-- .../ai_mail_json/branch_ping_config.json | 9 + .../ai_mail_json/branch_ping_data.json | 8 + .../ai_mail/ai_mail_json/branch_ping_log.json | 11 + .../local_memory_monitor_registry.json | 23 ++ src/aipass/ai_mail/apps/ai_mail.py | 1 - src/aipass/ai_mail/apps/handlers/__init__.py | 2 +- .../ai_mail/apps/handlers/central_writer.py | 28 +- .../ai_mail/apps/handlers/dispatch/daemon.py | 35 +- .../handlers/dispatch/dispatch_monitor.py | 1 - .../apps/handlers/dispatch/pending_work.py | 5 +- .../ai_mail/apps/handlers/dispatch/status.py | 7 +- .../ai_mail/apps/handlers/dispatch/wake.py | 23 +- .../ai_mail/apps/handlers/email/create.py | 1 - .../apps/handlers/email/dashboard_sync.py | 5 +- .../ai_mail/apps/handlers/email/delivery.py | 27 +- .../ai_mail/apps/handlers/email/footer.py | 1 - .../ai_mail/apps/handlers/email/format.py | 12 +- .../ai_mail/apps/handlers/email/header.py | 1 - .../apps/handlers/email/inbox_cleanup.py | 8 +- .../ai_mail/apps/handlers/email/inbox_lock.py | 1 - .../ai_mail/apps/handlers/email/inbox_ops.py | 1 - .../ai_mail/apps/handlers/email/lock_utils.py | 5 +- .../ai_mail/apps/handlers/email/purge.py | 17 +- .../ai_mail/apps/handlers/email/reply.py | 3 +- .../apps/handlers/json/json_handler.py | 8 +- .../apps/handlers/json_utils/json_handler.py | 12 +- .../apps/handlers/monitoring/data_ops.py | 1 - .../apps/handlers/monitoring/errors.py | 25 +- .../apps/handlers/monitoring/memory.py | 1 - .../apps/handlers/persistence/json_ops.py | 10 +- .../ai_mail/apps/handlers/registry/load.py | 1 - .../ai_mail/apps/handlers/registry/read.py | 18 +- .../ai_mail/apps/handlers/registry/update.py | 6 +- .../apps/handlers/registry/validate.py | 5 +- .../ai_mail/apps/handlers/trigger/__init__.py | 1 - .../apps/handlers/trigger/error_handler.py | 1 - .../apps/handlers/users/branch_detection.py | 16 +- .../apps/handlers/users/config_generator.py | 1 - .../ai_mail/apps/handlers/users/load.py | 6 +- .../ai_mail/apps/handlers/users/user.py | 7 +- .../ai_mail/apps/modules/branch_ping.py | 1 - src/aipass/ai_mail/apps/modules/dispatch.py | 3 +- src/aipass/ai_mail/apps/modules/email.py | 21 +- src/aipass/ai_mail/tests/conftest.py | 1 - src/aipass/api/api_json/api_config.json | 9 + src/aipass/api/api_json/api_data.json | 8 + src/aipass/api/api_json/api_key_config.json | 9 + src/aipass/api/api_json/api_key_data.json | 8 + src/aipass/api/api_json/api_key_log.json | 16 + src/aipass/api/api_json/api_log.json | 55 +++ .../api/api_json/usage_tracker_config.json | 9 + .../api/api_json/usage_tracker_data.json | 8 + .../api/api_json/usage_tracker_log.json | 9 + src/aipass/api/apps/api.py | 1 - src/aipass/api/apps/handlers/__init__.py | 2 +- src/aipass/api/apps/handlers/auth/env.py | 13 +- src/aipass/api/apps/handlers/auth/keys.py | 4 +- .../api/apps/handlers/config/provider.py | 1 - .../api/apps/handlers/json/json_handler.py | 8 +- .../api/apps/handlers/openrouter/caller.py | 1 - .../api/apps/handlers/openrouter/client.py | 1 - .../api/apps/handlers/openrouter/models.py | 5 +- .../api/apps/handlers/openrouter/provision.py | 1 - .../api/apps/handlers/telegram/__init__.py | 1 - .../api/apps/handlers/telegram/base_bot.py | 31 +- .../api/apps/handlers/telegram/bot_factory.py | 32 +- .../apps/handlers/telegram/bot_operations.py | 3 +- .../apps/handlers/telegram/bot_registry.py | 11 +- .../handlers/telegram/botfather_client.py | 11 +- .../apps/handlers/telegram/branch_plugin.py | 14 +- .../api/apps/handlers/telegram/config.py | 16 +- .../apps/handlers/telegram/file_handler.py | 1 - .../apps/handlers/telegram/log_streamer.py | 11 +- .../api/apps/handlers/telegram/notifier.py | 11 +- .../telegram/output_parser.py(disabled) | 6 +- .../apps/handlers/telegram/response_router.py | 18 +- .../handlers/telegram/spawner.py(disabled) | 21 +- .../handlers/telegram/telegram_standards.py | 1 - .../apps/handlers/telegram/tmux_manager.py | 3 +- .../apps/handlers/telegram_service/service.py | 12 +- .../api/apps/handlers/usage/aggregation.py | 3 +- src/aipass/api/apps/handlers/usage/cleanup.py | 2 - .../api/apps/handlers/usage/tracking.py | 3 +- src/aipass/api/apps/modules/api_key.py | 1 - .../api/apps/modules/openrouter_client.py | 1 - src/aipass/api/apps/modules/telegram_bot.py | 1 - .../api/apps/modules/telegram_service.py | 1 - src/aipass/api/apps/modules/usage_tracker.py | 3 +- src/aipass/api/tests/conftest.py | 1 - src/aipass/cli/apps/__init__.py | 1 - src/aipass/cli/apps/cli.py | 9 +- src/aipass/cli/apps/extensions/__init__.py | 1 - src/aipass/cli/apps/handlers/__init__.py | 3 +- .../cli/apps/handlers/json/json_handler.py | 7 +- .../cli/apps/json_templates/__init__.py | 1 - src/aipass/cli/apps/modules/display.py | 9 +- src/aipass/cli/apps/modules/templates.py | 9 +- src/aipass/cli/apps/plugins/__init__.py | 1 - src/aipass/cli/tests/conftest.py | 1 - .../devpulse/apps/{branch.py => devpulse.py} | 2 +- ...-001_path_rewire_portability_2026-03-06.md | 194 +++++++++++ src/aipass/devpulse/tests/conftest.py | 2 - src/aipass/drone/apps/modules/config.py | 4 +- src/aipass/drone/cli.py | 1 - src/aipass/drone/tests/conftest.py | 1 - src/aipass/flow/apps/flow.py | 1 - src/aipass/flow/apps/handlers/__init__.py | 2 +- .../flow/apps/handlers/config/load_config.py | 2 - .../flow/apps/handlers/dashboard/__init__.py | 1 - .../dashboard/push_branch_dashboard.py | 11 +- .../apps/handlers/dashboard/push_central.py | 17 +- .../apps/handlers/dashboard/update_local.py | 2 - .../flow/apps/handlers/json/json_handler.py | 3 +- .../flow/apps/handlers/mbank/process.py | 15 +- .../apps/handlers/plan/append_closed_plan.py | 1 - .../flow/apps/handlers/plan/auto_cleanup.py | 1 - .../handlers/plan/build_registry_entry.py | 5 +- .../handlers/plan/calculate_relative_path.py | 11 +- .../flow/apps/handlers/plan/command_parser.py | 1 - .../flow/apps/handlers/plan/confirmation.py | 1 - src/aipass/flow/apps/handlers/plan/create.py | 1 - .../flow/apps/handlers/plan/create_file.py | 1 - src/aipass/flow/apps/handlers/plan/display.py | 1 - .../flow/apps/handlers/plan/file_ops.py | 1 - .../apps/handlers/plan/get_closed_plans.py | 1 - .../flow/apps/handlers/plan/get_open_plans.py | 1 - .../apps/handlers/plan/resolve_location.py | 9 +- .../apps/handlers/plan/update_registry.py | 1 - .../flow/apps/handlers/plan/validator.py | 1 - .../apps/handlers/registry/load_registry.py | 1 - .../apps/handlers/registry/save_registry.py | 1 - .../flow/apps/handlers/registry/statistics.py | 1 - .../handlers/summary/generate.py(disabled) | 5 +- .../handlers/summary/write_plan_outputs.py | 30 +- .../apps/handlers/template/get_template.py | 4 +- .../apps/handlers/template/list_templates.py | 4 +- .../flow/apps/modules/aggregate_central.py | 15 +- src/aipass/flow/apps/modules/close_plan.py | 1 - src/aipass/flow/apps/modules/create_plan.py | 1 - src/aipass/flow/apps/modules/list_plans.py | 1 - .../flow/apps/modules/post_close_runner.py | 1 - .../flow/apps/modules/registry_monitor.py | 17 +- src/aipass/flow/apps/modules/restore_plan.py | 24 +- .../flow/flow_json/close_plan_config.json | 9 + .../flow/flow_json/close_plan_data.json | 8 + src/aipass/flow/flow_json/close_plan_log.json | 23 ++ .../flow/flow_json/create_plan_config.json | 9 + .../flow/flow_json/create_plan_data.json | 8 + .../flow/flow_json/create_plan_log.json | 21 ++ src/aipass/flow/flow_json/flow_registry.json | 5 + .../flow/flow_json/list_plans_config.json | 9 + .../flow/flow_json/list_plans_data.json | 8 + src/aipass/flow/flow_json/list_plans_log.json | 18 + src/aipass/flow/tests/conftest.py | 1 - src/aipass/prax/apps/handlers/__init__.py | 10 +- .../apps/handlers/config/ignore_patterns.py | 1 - src/aipass/prax/apps/handlers/config/load.py | 24 +- .../prax/apps/handlers/dashboard/__init__.py | 1 - .../handlers/dashboard/agent_status_writer.py | 20 +- .../prax/apps/handlers/discovery/filtering.py | 1 - .../prax/apps/handlers/discovery/scanner.py | 5 +- .../prax/apps/handlers/discovery/watcher.py | 5 +- .../prax/apps/handlers/json/initialize.py | 1 - .../prax/apps/handlers/json/json_handler.py | 3 +- src/aipass/prax/apps/handlers/json/load.py | 1 - src/aipass/prax/apps/handlers/json/log.py | 1 - src/aipass/prax/apps/handlers/json/save.py | 1 - .../apps/handlers/logging/cli_commands.py | 1 - .../prax/apps/handlers/logging/direct.py | 10 +- .../apps/handlers/logging/introspection.py | 37 +- .../apps/handlers/logging/log_watchdog.py | 24 +- .../prax/apps/handlers/logging/monitoring.py | 1 - .../prax/apps/handlers/logging/operations.py | 1 - .../prax/apps/handlers/logging/override.py | 1 - .../prax/apps/handlers/logging/setup.py | 21 +- .../handlers/logging/terminal/filtering.py | 1 - .../handlers/logging/terminal/formatting.py | 1 - .../monitoring/INTEGRATION_EXAMPLE.py | 3 +- .../monitoring/MONITOR_MODULE_INTEGRATION.py | 3 +- .../prax/apps/handlers/monitoring/__init__.py | 1 - .../handlers/monitoring/branch_detector.py | 42 ++- .../apps/handlers/monitoring/event_queue.py | 1 - .../monitoring/file_watcher_integration.py | 6 +- .../handlers/monitoring/interactive_filter.py | 1 - .../apps/handlers/monitoring/log_watcher.py | 27 +- .../handlers/monitoring/module_tracker.py | 1 - .../handlers/monitoring/monitoring_filters.py | 1 - .../monitoring/telegram_command_bot.py | 54 ++- .../handlers/monitoring/telegram_relay.py | 15 +- .../handlers/monitoring/unified_stream.py | 1 - .../prax/apps/handlers/registry/ignore.py | 2 - .../prax/apps/handlers/registry/load.py | 1 - .../prax/apps/handlers/registry/meta_ops.py | 16 +- .../prax/apps/handlers/registry/reader.py | 22 +- .../prax/apps/handlers/registry/save.py | 3 +- .../prax/apps/handlers/registry/statistics.py | 3 +- .../prax/apps/handlers/watcher/monitor.py | 1 - .../prax/apps/handlers/watcher/reporter.py | 3 +- src/aipass/prax/apps/modules/__init__.py | 2 +- .../prax/apps/modules/agent_status_module.py | 1 - .../prax/apps/modules/discover_module.py | 1 - src/aipass/prax/apps/modules/init_module.py | 1 - .../prax/apps/modules/log_audit_module.py | 3 +- src/aipass/prax/apps/modules/logger.py | 7 +- .../prax/apps/modules/monitor_module.py | 26 +- src/aipass/prax/apps/modules/run_module.py | 1 - .../prax/apps/modules/shutdown_module.py | 1 - src/aipass/prax/apps/modules/status_module.py | 1 - .../prax/apps/modules/terminal_module.py | 1 - src/aipass/prax/apps/prax.py | 3 +- src/aipass/prax/tests/conftest.py | 1 - src/aipass/seedgo/apps/seedgo.py | 6 - .../aipass/handlers/audit/branch_audit.py | 74 ++-- .../aipass/handlers/audit/bypass_audit.py | 24 +- .../aipass/handlers/config/__init__.py | 21 +- .../aipass/handlers/diagnostics/runner.py | 2 +- .../aipass/handlers/json/json_handler.py | 2 +- .../handlers/standards/architecture_check.py | 6 +- .../standards/architecture_content.py | 6 +- .../aipass/handlers/standards/cli_content.py | 7 +- .../handlers/standards/cli_flags_content.py | 2 +- .../handlers/standards/diagnostics_check.py | 4 +- .../standards/documentation_content.py | 45 +-- .../handlers/standards/encapsulation_check.py | 2 +- .../standards/error_handling_content.py | 6 +- .../handlers/standards/handlers_check.py | 2 +- .../handlers/standards/handlers_content.py | 6 +- .../handlers/standards/imports_check.py | 107 ++++++ .../handlers/standards/imports_content.py | 21 +- .../standards/json_structure_content.py | 10 +- .../handlers/standards/modules_content.py | 6 +- .../handlers/standards/naming_content.py | 2 +- .../aipass/handlers/standards/readme_check.py | 4 +- .../handlers/standards/readme_generator.py | 6 +- .../handlers/standards/shebang_check.py | 102 ++++++ .../handlers/standards/trigger_content.py | 6 +- .../aipass/handlers/verify/command_check.py | 2 +- .../aipass/handlers/verify/help_check.py | 4 +- .../aipass/handlers/verify/orchestrator.py | 10 +- .../aipass/handlers/verify/stale_check.py | 4 +- .../aipass/modules/architecture_standard.py | 6 +- .../aipass/modules/cli_flags_standard.py | 4 +- .../standards/aipass/modules/cli_standard.py | 6 +- .../aipass/modules/diagnostics_audit.py | 6 +- .../aipass/modules/documentation_standard.py | 6 +- .../aipass/modules/error_handling_standard.py | 6 +- .../aipass/modules/handlers_standard.py | 8 +- .../aipass/modules/imports_standard.py | 6 +- .../aipass/modules/json_structure_standard.py | 6 +- .../aipass/modules/log_handler_standard.py | 4 +- .../aipass/modules/log_level_standard.py | 4 +- .../aipass/modules/log_visibility_standard.py | 4 +- .../aipass/modules/modules_standard.py | 6 +- .../aipass/modules/naming_standard.py | 6 +- .../modules/permission_flags_standard.py | 4 +- .../standards/aipass/modules/readme_update.py | 4 +- .../aipass/modules/standards_audit.py | 12 +- .../aipass/modules/standards_checklist.py | 95 ++++-- .../aipass/modules/trigger_standard.py | 6 +- .../aipass_code_standards/architecture.md | 34 +- .../docs/aipass_code_standards/cli_flags.md | 8 +- .../aipass_code_standards/documentation.md | 280 +++++---------- src/aipass/seedgo/tests/conftest.py | 20 +- src/aipass/spawn/apps/__init__.py | 0 src/aipass/spawn/apps/handlers/__init__.py | 0 src/aipass/spawn/apps/modules/__init__.py | 0 src/aipass/spawn/apps/spawn.py | 116 +++++++ .../agent.template/tests/conftest.py | 1 - .../agent.template/tools/verify_branch.py | 14 +- .../agent_mock_branch/tests/conftest.py | 1 - .../agent_mock_branch/tools/verify_branch.py | 14 +- src/aipass/trigger/apps/handlers/__init__.py | 2 +- .../trigger/apps/handlers/error_registry.py | 5 +- .../apps/handlers/events/bulletin_created.py | 15 +- .../trigger/apps/handlers/events/cli.py | 1 - .../apps/handlers/events/error_detected.py | 13 +- .../apps/handlers/events/error_logged.py | 13 +- .../trigger/apps/handlers/events/memory.py | 1 - .../events/memory_template_updated.py | 4 +- .../events/memory_threshold_exceeded.py | 4 +- .../trigger/apps/handlers/events/plan_file.py | 17 +- .../trigger/apps/handlers/events/registry.py | 1 - .../trigger/apps/handlers/events/startup.py | 5 +- .../apps/handlers/events/warning_logged.py | 1 - .../apps/handlers/json/json_handler.py | 3 +- .../trigger/apps/handlers/log_watcher.py | 35 +- .../trigger/apps/handlers/medic_state.py | 1 - .../apps/handlers/watchers/log_watcher.py | 10 +- .../trigger/apps/modules/branch_log_events.py | 5 +- src/aipass/trigger/apps/modules/core.py | 3 +- src/aipass/trigger/apps/modules/errors.py | 1 - src/aipass/trigger/apps/modules/log_events.py | 3 +- src/aipass/trigger/apps/modules/medic.py | 3 +- src/aipass/trigger/apps/trigger.py | 3 +- src/aipass/trigger/tests/conftest.py | 1 - .../trigger/trigger_json/trigger_data.json | 8 +- system_logs/ai_mail_ai_mail.log | 35 ++ system_logs/ai_mail_dispatch.log | 1 + system_logs/api_api.log | 29 ++ system_logs/flow_aggregate_central.log | 6 + system_logs/flow_close_plan.log | 4 + system_logs/flow_create_plan.log | 2 + system_logs/flow_flow.log | 77 +++++ system_logs/flow_list_plans.log | 2 + system_logs/prax_monitor_module.log | 2 + system_logs/prax_unknown_module.log | 2 + system_logs/seedgo_seedgo_verify.log | 1 + system_logs/seedgo_standards_checklist.log | 78 +++++ system_logs/trigger_core.log | 128 +++++++ system_logs/trigger_trigger.log | 35 ++ trigger/logs/core.log | 128 +++++++ trigger/logs/trigger.log | 35 ++ 327 files changed, 3106 insertions(+), 1169 deletions(-) create mode 100644 AI_CENTRAL/PLANS.central.json create mode 100644 ai_mail/logs/ai_mail.log create mode 100644 ai_mail/logs/dispatch.log create mode 100644 api/logs/api.log create mode 100644 flow/logs/aggregate_central.log create mode 100644 flow/logs/close_plan.log create mode 100644 flow/logs/create_plan.log create mode 100644 flow/logs/flow.log create mode 100644 flow/logs/list_plans.log create mode 100644 notepad.md create mode 100644 prax/logs/monitor_module.log create mode 100644 seedgo/logs/seedgo_verify.log create mode 100644 seedgo/logs/standards_checklist.log create mode 100644 src/aipass/ai_mail/ai_mail_json/branch_ping_config.json create mode 100644 src/aipass/ai_mail/ai_mail_json/branch_ping_data.json create mode 100644 src/aipass/ai_mail/ai_mail_json/branch_ping_log.json create mode 100644 src/aipass/ai_mail/ai_mail_json/local_memory_monitor_registry.json create mode 100644 src/aipass/api/api_json/api_config.json create mode 100644 src/aipass/api/api_json/api_data.json create mode 100644 src/aipass/api/api_json/api_key_config.json create mode 100644 src/aipass/api/api_json/api_key_data.json create mode 100644 src/aipass/api/api_json/api_key_log.json create mode 100644 src/aipass/api/api_json/api_log.json create mode 100644 src/aipass/api/api_json/usage_tracker_config.json create mode 100644 src/aipass/api/api_json/usage_tracker_data.json create mode 100644 src/aipass/api/api_json/usage_tracker_log.json rename src/aipass/devpulse/apps/{branch.py => devpulse.py} (97%) create mode 100644 src/aipass/devpulse/docs/FPLAN-001_path_rewire_portability_2026-03-06.md create mode 100644 src/aipass/flow/flow_json/close_plan_config.json create mode 100644 src/aipass/flow/flow_json/close_plan_data.json create mode 100644 src/aipass/flow/flow_json/close_plan_log.json create mode 100644 src/aipass/flow/flow_json/create_plan_config.json create mode 100644 src/aipass/flow/flow_json/create_plan_data.json create mode 100644 src/aipass/flow/flow_json/create_plan_log.json create mode 100644 src/aipass/flow/flow_json/flow_registry.json create mode 100644 src/aipass/flow/flow_json/list_plans_config.json create mode 100644 src/aipass/flow/flow_json/list_plans_data.json create mode 100644 src/aipass/flow/flow_json/list_plans_log.json create mode 100644 src/aipass/seedgo/apps/standards/aipass/handlers/standards/shebang_check.py create mode 100644 src/aipass/spawn/apps/__init__.py create mode 100644 src/aipass/spawn/apps/handlers/__init__.py create mode 100644 src/aipass/spawn/apps/modules/__init__.py create mode 100644 src/aipass/spawn/apps/spawn.py create mode 100644 system_logs/ai_mail_ai_mail.log create mode 100644 system_logs/ai_mail_dispatch.log create mode 100644 system_logs/api_api.log create mode 100644 system_logs/flow_aggregate_central.log create mode 100644 system_logs/flow_close_plan.log create mode 100644 system_logs/flow_create_plan.log create mode 100644 system_logs/flow_flow.log create mode 100644 system_logs/flow_list_plans.log create mode 100644 system_logs/prax_monitor_module.log create mode 100644 system_logs/prax_unknown_module.log create mode 100644 system_logs/seedgo_seedgo_verify.log create mode 100644 system_logs/seedgo_standards_checklist.log create mode 100644 system_logs/trigger_core.log create mode 100644 system_logs/trigger_trigger.log create mode 100644 trigger/logs/core.log create mode 100644 trigger/logs/trigger.log diff --git a/AI_CENTRAL/PLANS.central.json b/AI_CENTRAL/PLANS.central.json new file mode 100644 index 00000000..ba4d80ee --- /dev/null +++ b/AI_CENTRAL/PLANS.central.json @@ -0,0 +1,49 @@ +{ + "generated_at": "2026-03-06T20:20:39.989231+00:00", + "branches": { + "flow": { + "branch_name": "FLOW", + "branch_path": "/home/coder/workspace/src/aipass/flow", + "last_updated": "2026-03-06T20:20:39.988098+00:00", + "active_plans": [ + { + "plan_id": "FPLAN-0002", + "subject": "", + "status": "open", + "created": "2026-03-06T20:20:39.986512+00:00", + "file_path": "/home/coder/workspace/src/aipass/flow/FPLAN-0002_2026-03-06.md", + "relative_path": "flow", + "branch": "flow" + } + ], + "recently_closed": [], + "statistics": { + "active_count": 1, + "total_closed": 0, + "recently_closed_included": 0 + } + } + }, + "global_statistics": { + "total_active": 1, + "total_closed": 0, + "branches_reporting": 1 + }, + "active_plans": [ + { + "plan_id": "FPLAN-0002", + "subject": "", + "status": "open", + "created": "2026-03-06T20:20:39.986512+00:00", + "file_path": "/home/coder/workspace/src/aipass/flow/FPLAN-0002_2026-03-06.md", + "relative_path": "flow", + "branch": "flow" + } + ], + "recently_closed": [], + "statistics": { + "active_count": 1, + "total_closed": 0, + "recently_closed_included": 0 + } +} \ No newline at end of file diff --git a/ai_mail/logs/ai_mail.log b/ai_mail/logs/ai_mail.log new file mode 100644 index 00000000..b01f0233 --- /dev/null +++ b/ai_mail/logs/ai_mail.log @@ -0,0 +1,35 @@ +2026-03-06 19:26:01 - captured_ai_mail - INFO - [ai_mail] Discovering modules... +2026-03-06 19:26:01 - captured_ai_mail - ERROR - [-] aipass.ai_mail.apps.modules.email - import error: No module named 'aipass.dev_central' +2026-03-06 19:26:01 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.dispatch +2026-03-06 19:26:01 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.branch_ping +2026-03-06 19:26:01 - captured_ai_mail - INFO - [ai_mail] Discovered 2 modules +2026-03-06 19:26:27 - captured_ai_mail - INFO - [ai_mail] Discovering modules... +2026-03-06 19:26:27 - captured_ai_mail - ERROR - [-] aipass.ai_mail.apps.modules.email - import error: No module named 'aipass.dev_central' +2026-03-06 19:26:27 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.dispatch +2026-03-06 19:26:27 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.branch_ping +2026-03-06 19:26:27 - captured_ai_mail - INFO - [ai_mail] Discovered 2 modules +2026-03-06 20:32:14 - captured_ai_mail - INFO - [ai_mail] Discovering modules... +2026-03-06 20:32:14 - captured_ai_mail - ERROR - [-] aipass.ai_mail.apps.modules.email - import error: No module named 'aipass.dev_central' +2026-03-06 20:32:14 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.dispatch +2026-03-06 20:32:14 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.branch_ping +2026-03-06 20:32:14 - captured_ai_mail - INFO - [ai_mail] Discovered 2 modules +2026-03-06 20:32:37 - captured_ai_mail - INFO - [ai_mail] Discovering modules... +2026-03-06 20:32:37 - captured_ai_mail - ERROR - [-] aipass.ai_mail.apps.modules.email - import error: No module named 'aipass.dev_central' +2026-03-06 20:32:37 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.dispatch +2026-03-06 20:32:37 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.branch_ping +2026-03-06 20:32:37 - captured_ai_mail - INFO - [ai_mail] Discovered 2 modules +2026-03-06 20:32:42 - captured_ai_mail - INFO - [ai_mail] Discovering modules... +2026-03-06 20:32:42 - captured_ai_mail - ERROR - [-] aipass.ai_mail.apps.modules.email - import error: No module named 'aipass.dev_central' +2026-03-06 20:32:42 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.dispatch +2026-03-06 20:32:42 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.branch_ping +2026-03-06 20:32:42 - captured_ai_mail - INFO - [ai_mail] Discovered 2 modules +2026-03-06 20:33:19 - captured_ai_mail - INFO - [ai_mail] Discovering modules... +2026-03-06 20:33:19 - captured_ai_mail - ERROR - [-] aipass.ai_mail.apps.modules.email - import error: No module named 'aipass.dev_central' +2026-03-06 20:33:19 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.dispatch +2026-03-06 20:33:19 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.branch_ping +2026-03-06 20:33:19 - captured_ai_mail - INFO - [ai_mail] Discovered 2 modules +2026-03-06 20:33:19 - captured_ai_mail - INFO - [ai_mail] Discovering modules... +2026-03-06 20:33:19 - captured_ai_mail - ERROR - [-] aipass.ai_mail.apps.modules.email - import error: No module named 'aipass.dev_central' +2026-03-06 20:33:19 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.dispatch +2026-03-06 20:33:19 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.branch_ping +2026-03-06 20:33:19 - captured_ai_mail - INFO - [ai_mail] Discovered 2 modules diff --git a/ai_mail/logs/dispatch.log b/ai_mail/logs/dispatch.log new file mode 100644 index 00000000..58f0a13f --- /dev/null +++ b/ai_mail/logs/dispatch.log @@ -0,0 +1 @@ +2026-03-06 20:33:19 - captured_dispatch - INFO - [dispatch] Showing dispatch status diff --git a/api/logs/api.log b/api/logs/api.log new file mode 100644 index 00000000..85218703 --- /dev/null +++ b/api/logs/api.log @@ -0,0 +1,29 @@ +2026-03-06 19:25:57 - captured_api - INFO - [api] Discovering modules... +2026-03-06 19:25:57 - captured_api - INFO - [+] telegram_service +2026-03-06 19:25:57 - captured_api - INFO - [+] telegram_bot +2026-03-06 19:25:57 - captured_api - INFO - [+] api_key +2026-03-06 19:25:57 - captured_api - ERROR - [-] openrouter_client - import error: name 'OpenAI' is not defined +2026-03-06 19:25:57 - captured_api - INFO - [+] usage_tracker +2026-03-06 19:25:57 - captured_api - INFO - [api] Discovered 4 modules +2026-03-06 19:25:57 - captured_api - WARNING - Unknown command: test +2026-03-06 19:26:31 - captured_api - INFO - [api] Discovering modules... +2026-03-06 19:26:31 - captured_api - INFO - [+] telegram_service +2026-03-06 19:26:31 - captured_api - INFO - [+] telegram_bot +2026-03-06 19:26:31 - captured_api - INFO - [+] api_key +2026-03-06 19:26:31 - captured_api - ERROR - [-] openrouter_client - import error: name 'OpenAI' is not defined +2026-03-06 19:26:31 - captured_api - INFO - [+] usage_tracker +2026-03-06 19:26:31 - captured_api - INFO - [api] Discovered 4 modules +2026-03-06 19:26:38 - captured_api - INFO - [api] Discovering modules... +2026-03-06 19:26:38 - captured_api - INFO - [+] telegram_service +2026-03-06 19:26:38 - captured_api - INFO - [+] telegram_bot +2026-03-06 19:26:38 - captured_api - INFO - [+] api_key +2026-03-06 19:26:38 - captured_api - ERROR - [-] openrouter_client - import error: name 'OpenAI' is not defined +2026-03-06 19:26:38 - captured_api - INFO - [+] usage_tracker +2026-03-06 19:26:38 - captured_api - INFO - [api] Discovered 4 modules +2026-03-06 19:26:41 - captured_api - INFO - [api] Discovering modules... +2026-03-06 19:26:41 - captured_api - INFO - [+] telegram_service +2026-03-06 19:26:41 - captured_api - INFO - [+] telegram_bot +2026-03-06 19:26:41 - captured_api - INFO - [+] api_key +2026-03-06 19:26:41 - captured_api - ERROR - [-] openrouter_client - import error: name 'OpenAI' is not defined +2026-03-06 19:26:41 - captured_api - INFO - [+] usage_tracker +2026-03-06 19:26:41 - captured_api - INFO - [api] Discovered 4 modules diff --git a/flow/logs/aggregate_central.log b/flow/logs/aggregate_central.log new file mode 100644 index 00000000..16772a69 --- /dev/null +++ b/flow/logs/aggregate_central.log @@ -0,0 +1,6 @@ +2026-03-06 19:26:45 - captured_aggregate_central - INFO - [aggregate_central] Starting central aggregation +2026-03-06 19:26:45 - captured_aggregate_central - INFO - [aggregate_central] Processing branch: flow +2026-03-06 19:26:45 - captured_aggregate_central - INFO - [aggregate_central] SUCCESS: Aggregation complete: 0 active, 0 recently closed +2026-03-06 20:20:39 - captured_aggregate_central - INFO - [aggregate_central] Starting central aggregation +2026-03-06 20:20:39 - captured_aggregate_central - INFO - [aggregate_central] Processing branch: flow +2026-03-06 20:20:39 - captured_aggregate_central - INFO - [aggregate_central] SUCCESS: Aggregation complete: 1 active, 0 recently closed diff --git a/flow/logs/close_plan.log b/flow/logs/close_plan.log new file mode 100644 index 00000000..f2bdde1a --- /dev/null +++ b/flow/logs/close_plan.log @@ -0,0 +1,4 @@ +2026-03-06 19:26:52 - captured_close_plan - INFO - [close_plan] Deleted empty template file: /tmp/FPLAN-0001_test_plan_from_devpulse_2026-03-06.md +2026-03-06 19:26:52 - captured_close_plan - INFO - [close_plan] Removed FPLAN-0001 from registry +2026-03-06 20:21:02 - captured_close_plan - INFO - [close_plan] Deleted empty template file: /home/coder/workspace/src/aipass/flow/FPLAN-0002_2026-03-06.md +2026-03-06 20:21:02 - captured_close_plan - INFO - [close_plan] Removed FPLAN-0002 from registry diff --git a/flow/logs/create_plan.log b/flow/logs/create_plan.log new file mode 100644 index 00000000..5a9510b1 --- /dev/null +++ b/flow/logs/create_plan.log @@ -0,0 +1,2 @@ +2026-03-06 19:26:45 - captured_create_plan - INFO - [create_plan] Created FPLAN-0001 in /tmp +2026-03-06 20:20:39 - captured_create_plan - INFO - [create_plan] Created FPLAN-0002 in flow diff --git a/flow/logs/flow.log b/flow/logs/flow.log new file mode 100644 index 00000000..ddf35a1b --- /dev/null +++ b/flow/logs/flow.log @@ -0,0 +1,77 @@ +2026-03-06 19:25:13 - captured_flow - INFO - [FLOW] Skipped post_close_runner - no handle_command() +2026-03-06 19:25:13 - captured_flow - INFO - [FLOW] Loaded module: aggregate_central +2026-03-06 19:25:13 - captured_flow - INFO - [FLOW] Loaded module: registry_monitor +2026-03-06 19:25:13 - captured_flow - INFO - [FLOW] Loaded module: restore_plan +2026-03-06 19:25:13 - captured_flow - INFO - [FLOW] Loaded module: list_plans +2026-03-06 19:25:13 - captured_flow - INFO - [FLOW] Loaded module: close_plan +2026-03-06 19:25:13 - captured_flow - INFO - [FLOW] Loaded module: create_plan +2026-03-06 19:25:53 - captured_flow - INFO - [FLOW] Skipped post_close_runner - no handle_command() +2026-03-06 19:25:53 - captured_flow - INFO - [FLOW] Loaded module: aggregate_central +2026-03-06 19:25:53 - captured_flow - INFO - [FLOW] Loaded module: registry_monitor +2026-03-06 19:25:53 - captured_flow - INFO - [FLOW] Loaded module: restore_plan +2026-03-06 19:25:53 - captured_flow - INFO - [FLOW] Loaded module: list_plans +2026-03-06 19:25:53 - captured_flow - INFO - [FLOW] Loaded module: close_plan +2026-03-06 19:25:53 - captured_flow - INFO - [FLOW] Loaded module: create_plan +2026-03-06 19:26:45 - captured_flow - INFO - [FLOW] Skipped post_close_runner - no handle_command() +2026-03-06 19:26:45 - captured_flow - INFO - [FLOW] Loaded module: aggregate_central +2026-03-06 19:26:45 - captured_flow - INFO - [FLOW] Loaded module: registry_monitor +2026-03-06 19:26:45 - captured_flow - INFO - [FLOW] Loaded module: restore_plan +2026-03-06 19:26:45 - captured_flow - INFO - [FLOW] Loaded module: list_plans +2026-03-06 19:26:45 - captured_flow - INFO - [FLOW] Loaded module: close_plan +2026-03-06 19:26:45 - captured_flow - INFO - [FLOW] Loaded module: create_plan +2026-03-06 19:26:49 - captured_flow - INFO - [FLOW] Skipped post_close_runner - no handle_command() +2026-03-06 19:26:49 - captured_flow - INFO - [FLOW] Loaded module: aggregate_central +2026-03-06 19:26:49 - captured_flow - INFO - [FLOW] Loaded module: registry_monitor +2026-03-06 19:26:49 - captured_flow - INFO - [FLOW] Loaded module: restore_plan +2026-03-06 19:26:49 - captured_flow - INFO - [FLOW] Loaded module: list_plans +2026-03-06 19:26:49 - captured_flow - INFO - [FLOW] Loaded module: close_plan +2026-03-06 19:26:49 - captured_flow - INFO - [FLOW] Loaded module: create_plan +2026-03-06 19:26:52 - captured_flow - INFO - [FLOW] Skipped post_close_runner - no handle_command() +2026-03-06 19:26:52 - captured_flow - INFO - [FLOW] Loaded module: aggregate_central +2026-03-06 19:26:52 - captured_flow - INFO - [FLOW] Loaded module: registry_monitor +2026-03-06 19:26:52 - captured_flow - INFO - [FLOW] Loaded module: restore_plan +2026-03-06 19:26:52 - captured_flow - INFO - [FLOW] Loaded module: list_plans +2026-03-06 19:26:52 - captured_flow - INFO - [FLOW] Loaded module: close_plan +2026-03-06 19:26:52 - captured_flow - INFO - [FLOW] Loaded module: create_plan +2026-03-06 20:20:13 - captured_flow - INFO - [FLOW] Skipped post_close_runner - no handle_command() +2026-03-06 20:20:13 - captured_flow - INFO - [FLOW] Loaded module: aggregate_central +2026-03-06 20:20:13 - captured_flow - INFO - [FLOW] Loaded module: registry_monitor +2026-03-06 20:20:13 - captured_flow - INFO - [FLOW] Loaded module: restore_plan +2026-03-06 20:20:13 - captured_flow - INFO - [FLOW] Loaded module: list_plans +2026-03-06 20:20:13 - captured_flow - INFO - [FLOW] Loaded module: close_plan +2026-03-06 20:20:13 - captured_flow - INFO - [FLOW] Loaded module: create_plan +2026-03-06 20:20:22 - captured_flow - INFO - [FLOW] Skipped post_close_runner - no handle_command() +2026-03-06 20:20:22 - captured_flow - INFO - [FLOW] Loaded module: aggregate_central +2026-03-06 20:20:22 - captured_flow - INFO - [FLOW] Loaded module: registry_monitor +2026-03-06 20:20:22 - captured_flow - INFO - [FLOW] Loaded module: restore_plan +2026-03-06 20:20:22 - captured_flow - INFO - [FLOW] Loaded module: list_plans +2026-03-06 20:20:22 - captured_flow - INFO - [FLOW] Loaded module: close_plan +2026-03-06 20:20:22 - captured_flow - INFO - [FLOW] Loaded module: create_plan +2026-03-06 20:20:39 - captured_flow - INFO - [FLOW] Skipped post_close_runner - no handle_command() +2026-03-06 20:20:39 - captured_flow - INFO - [FLOW] Loaded module: aggregate_central +2026-03-06 20:20:39 - captured_flow - INFO - [FLOW] Loaded module: registry_monitor +2026-03-06 20:20:39 - captured_flow - INFO - [FLOW] Loaded module: restore_plan +2026-03-06 20:20:39 - captured_flow - INFO - [FLOW] Loaded module: list_plans +2026-03-06 20:20:39 - captured_flow - INFO - [FLOW] Loaded module: close_plan +2026-03-06 20:20:39 - captured_flow - INFO - [FLOW] Loaded module: create_plan +2026-03-06 20:21:02 - captured_flow - INFO - [FLOW] Skipped post_close_runner - no handle_command() +2026-03-06 20:21:02 - captured_flow - INFO - [FLOW] Loaded module: aggregate_central +2026-03-06 20:21:02 - captured_flow - INFO - [FLOW] Loaded module: registry_monitor +2026-03-06 20:21:02 - captured_flow - INFO - [FLOW] Loaded module: restore_plan +2026-03-06 20:21:02 - captured_flow - INFO - [FLOW] Loaded module: list_plans +2026-03-06 20:21:02 - captured_flow - INFO - [FLOW] Loaded module: close_plan +2026-03-06 20:21:02 - captured_flow - INFO - [FLOW] Loaded module: create_plan +2026-03-06 20:37:06 - captured_flow - INFO - [FLOW] Skipped post_close_runner - no handle_command() +2026-03-06 20:37:06 - captured_flow - INFO - [FLOW] Loaded module: aggregate_central +2026-03-06 20:37:06 - captured_flow - INFO - [FLOW] Loaded module: registry_monitor +2026-03-06 20:37:06 - captured_flow - INFO - [FLOW] Loaded module: restore_plan +2026-03-06 20:37:06 - captured_flow - INFO - [FLOW] Loaded module: list_plans +2026-03-06 20:37:06 - captured_flow - INFO - [FLOW] Loaded module: close_plan +2026-03-06 20:37:06 - captured_flow - INFO - [FLOW] Loaded module: create_plan +2026-03-06 20:38:04 - captured_flow - INFO - [FLOW] Skipped post_close_runner - no handle_command() +2026-03-06 20:38:04 - captured_flow - INFO - [FLOW] Loaded module: aggregate_central +2026-03-06 20:38:04 - captured_flow - INFO - [FLOW] Loaded module: registry_monitor +2026-03-06 20:38:04 - captured_flow - INFO - [FLOW] Loaded module: restore_plan +2026-03-06 20:38:04 - captured_flow - INFO - [FLOW] Loaded module: list_plans +2026-03-06 20:38:04 - captured_flow - INFO - [FLOW] Loaded module: close_plan +2026-03-06 20:38:04 - captured_flow - INFO - [FLOW] Loaded module: create_plan diff --git a/flow/logs/list_plans.log b/flow/logs/list_plans.log new file mode 100644 index 00000000..3aa9e8f2 --- /dev/null +++ b/flow/logs/list_plans.log @@ -0,0 +1,2 @@ +2026-03-06 19:25:53 - captured_list_plans - INFO - [list_plans] No plans in registry +2026-03-06 19:26:49 - captured_list_plans - INFO - [list_plans] Listed plans (filter: open) diff --git a/notepad.md b/notepad.md new file mode 100644 index 00000000..e69de29b diff --git a/prax/logs/monitor_module.log b/prax/logs/monitor_module.log new file mode 100644 index 00000000..3194a590 --- /dev/null +++ b/prax/logs/monitor_module.log @@ -0,0 +1,2 @@ +2026-03-06 20:19:23 - captured_monitor_module - INFO - Starting unified monitoring (args: []) +2026-03-06 20:19:23 - captured_monitor_module - INFO - All monitoring threads started diff --git a/pyproject.toml b/pyproject.toml index 3593398b..b295d55c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,10 +48,10 @@ dev = [ [project.scripts] drone = "aipass.drone.cli:main" -seedgo = "seedgo.cli:main" +seedgo = "aipass.seedgo.apps.seedgo:main" [tool.hatch.build.targets.wheel] -packages = ["src/aipass", "src/seedgo"] +packages = ["src/aipass"] [tool.pytest.ini_options] testpaths = ["tests"] diff --git a/seedgo/logs/seedgo_verify.log b/seedgo/logs/seedgo_verify.log new file mode 100644 index 00000000..367ee470 --- /dev/null +++ b/seedgo/logs/seedgo_verify.log @@ -0,0 +1 @@ +2026-03-06 19:24:36 - captured_seedgo_verify - INFO - Seedgo verify: 5/5 (100%) diff --git a/seedgo/logs/standards_checklist.log b/seedgo/logs/standards_checklist.log new file mode 100644 index 00000000..1cce6cb5 --- /dev/null +++ b/seedgo/logs/standards_checklist.log @@ -0,0 +1,78 @@ +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Starting standards compliance check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - ERROR - [standards_checklist] Error reading branch registry: name 'BRANCH_REGISTRY_PATH' is not defined +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running IMPORTS standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] IMPORTS check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running ARCHITECTURE standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] ARCHITECTURE check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running NAMING standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] NAMING check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running CLI standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] CLI check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running HANDLERS standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] HANDLERS check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running MODULES standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] MODULES check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running DOCUMENTATION standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] DOCUMENTATION check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running JSON_STRUCTURE standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] JSON_STRUCTURE check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running TESTING standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] TESTING check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running ERROR_HANDLING standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] ERROR_HANDLING check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running ENCAPSULATION standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] ENCAPSULATION check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running TRIGGER standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] TRIGGER check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running LOG_LEVEL standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] LOG_LEVEL check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running CLI_FLAGS standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] CLI_FLAGS check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running LOG_HANDLER standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] LOG_HANDLER check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running LOG_VISIBILITY standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] LOG_VISIBILITY check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running PERMISSION_FLAGS standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] PERMISSION_FLAGS check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running SHEBANG standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] SHEBANG check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Standards check complete: 0% average compliance +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Starting standards compliance check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - ERROR - [standards_checklist] Error reading branch registry: name 'BRANCH_REGISTRY_PATH' is not defined +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running IMPORTS standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] IMPORTS check complete: 80/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running ARCHITECTURE standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] ARCHITECTURE check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running NAMING standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] NAMING check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running CLI standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] CLI check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running HANDLERS standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] HANDLERS check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running MODULES standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] MODULES check complete: 60/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running DOCUMENTATION standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] DOCUMENTATION check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running JSON_STRUCTURE standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] JSON_STRUCTURE check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running TESTING standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] TESTING check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running ERROR_HANDLING standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] ERROR_HANDLING check complete: 66/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running ENCAPSULATION standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] ENCAPSULATION check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running TRIGGER standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] TRIGGER check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running LOG_LEVEL standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] LOG_LEVEL check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running CLI_FLAGS standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] CLI_FLAGS check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running LOG_HANDLER standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] LOG_HANDLER check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running LOG_VISIBILITY standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] LOG_VISIBILITY check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running PERMISSION_FLAGS standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] PERMISSION_FLAGS check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running SHEBANG standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] SHEBANG check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Standards check complete: 94% average compliance diff --git a/src/aipass/ai_mail/README.md b/src/aipass/ai_mail/README.md index 285c67ae..6258dbb9 100644 --- a/src/aipass/ai_mail/README.md +++ b/src/aipass/ai_mail/README.md @@ -1,51 +1,308 @@ -# AI_MAIL - -**Purpose:** Inter-agent messaging, inbox management, dispatch delivery -**Module:** `aipass.ai_mail` -**Created:** 2026-03-05 - ---- +# AI_MAIL - Branch Documentation ## Overview -### What I Do +**Location**: `/home/aipass/aipass_core/ai_mail` +**Profile**: Communication Infrastructure +**Purpose**: Branch-to-branch email system providing file-based messaging for AI branches +**Created**: 2025-11-07 +## What I Do -### How I Work -- **Entry Point:** `apps/ai_mail.py` -- **Pattern:** Auto-discovers and routes to modules +AI_MAIL provides internal email system for AI branches within AIPass. Core responsibilities include: ---- +- Deliver email messages between AI branches +- Manage inbox, sent, and deleted mailboxes for each branch +- Track email lifecycle: new → opened → closed +- Support reply chains with auto-close behavior +- Auto-generate per-branch configs (user_config.json in [branch]_json/) +- Auto-detect calling branch via PWD/CWD for sender identity +- Update dashboard on delivery (DASHBOARD.local.json) +- Dispatch daemon: continuous polling engine spawns agents for `--dispatch` emails +- Single instance per branch locking (PID-based dispatch lock) +- Reply chain validation (sender must match dispatched_to) +- Maintain 100% CLI standards compliance +- Preserve branch email identities (no impersonation) + +## What I Don't Do + +- No SMTP/IMAP protocols +- No external email delivery +- No human email accounts +- No centralized identity (each branch has independent config) +- No manual setup required from branches + +## How I Work + +File-based architecture using JSON for message storage. PWD auto-detection finds calling branch, checks for local config in [branch]_json/, generates config if missing, sends from detected branch identity. + +3-layer handler architecture: +- **Modules**: Orchestrate commands +- **Handlers**: Execute business logic +- **Prax**: Provides logging infrastructure ## Architecture +**Pattern**: Modular architecture +**Structure**: apps/ directory with modules/ and handlers/ subdirectories +**Orchestrator**: apps/ai_mail.py - auto-discovers and routes to modules +**Module Interface**: All modules implement handle_command(args) -> bool + +### Directory Structure + ``` -AI_MAIL/ -├── apps/ -│ ├── ai_mail.py # Entry point -│ ├── modules/ # Business logic -│ ├── handlers/ # Implementation -│ └── plugins/ # Extensions -├── docs/ -├── tests/ -├── passport.json # Identity -├── local.json # Session history -├── observations.json # Collaboration patterns -└── README.md +apps/ +├── ai_mail.py # Main orchestrator +├── __init__.py +├── modules/ +│ ├── email.py # Core email functionality +│ ├── branch_ping.py # Branch health monitoring +│ ├── dispatch.py # Dispatch status tracking +│ └── extensions/ # Module extensions +├── handlers/ +│ ├── central_writer.py # Central file updates +│ ├── dispatch/ # Dispatch operations +│ │ ├── daemon.py # Continuous dispatch daemon (polling + spawning) +│ │ ├── pending_work.py # Per-branch pending work tracking +│ │ └── status.py # Dispatch log and status +│ ├── email/ # Email operations +│ │ ├── create.py # Create email messages +│ │ ├── delivery.py # Deliver to branch inboxes (write-only, no spawning) +│ │ ├── format.py # Email formatting +│ │ ├── footer.py # Auto-footer for outgoing emails +│ │ ├── header.py # Email header formatting +│ │ ├── inbox_cleanup.py # Inbox cleanup operations +│ │ ├── inbox_lock.py # Inbox file locking +│ │ ├── inbox_ops.py # Inbox operations +│ │ ├── lock_utils.py # PID-based dispatch lock per branch +│ │ ├── purge.py # Auto-purge sent/deleted when >10 items +│ │ └── reply.py # Reply handling with chain validation +│ ├── json_utils/ # JSON operations +│ │ └── json_handler.py # JSON file operations +│ ├── monitoring/ # System monitoring +│ │ ├── data_ops.py # Data operations +│ │ ├── errors.py # Error handling +│ │ └── memory.py # Memory health checks +│ ├── persistence/ # Data persistence +│ │ └── json_ops.py # JSON persistence ops +│ ├── registry/ # Branch registry +│ │ ├── load.py # Load registry +│ │ ├── read.py # Read registry data +│ │ ├── update.py # Update registry +│ │ └── validate.py # Validate registry +│ ├── trigger/ # Event consumers +│ │ └── error_handler.py # Handle error_detected events +│ └── users/ # User/branch config +│ ├── branch_detection.py # Auto-detect calling branch +│ ├── config_generator.py # Generate branch configs +│ ├── load.py # Load configurations +│ └── user.py # User operations +├── extensions/ # App extensions (placeholder) +├── plugins/ # Plugins (placeholder) +└── json_templates/ # JSON templates + ├── custom/ # Custom templates + ├── default/ # Default templates + └── registry/ # Registry templates ``` ---- +### Modules -## Commands +- `email` - Core email functionality (send, inbox, view, reply, close, sent, contacts) +- `branch_ping` - Branch memory health monitoring +- `dispatch` - Dispatch status tracking, log, and daemon management -*Configure after initialization* +### Handlers (by domain) ---- +**Dispatch**: daemon, pending_work, status +**Email**: create, delivery, footer, format, header, inbox_cleanup, inbox_lock, inbox_ops, lock_utils, purge, reply +**JSON Utils**: json_handler +**Monitoring**: data_ops, errors, memory +**Persistence**: json_ops +**Registry**: load, read, update, validate +**Trigger**: error_handler +**Users**: branch_detection, config_generator, load, user + +## Usage + +Primary commands: `inbox`, `view`, `reply`, `close`, `send`, `sent`, `contacts`, `ping`, `dispatch`. + +### Email Lifecycle v2 + +AI_MAIL uses a 3-state email model: + +**States:** +- `new` - Email just delivered, never viewed +- `opened` - Email content has been viewed, awaiting resolution +- `closed` - Email resolved (replied or dismissed), archived to deleted + +**Flow:** +``` +Email sent → inbox (status: "new") + ↓ + view → status: "opened" + ↓ + ┌──────────┴──────────┐ + ↓ ↓ +reply "msg" close + ↓ ↓ +auto-closes closes + └──────────┬──────────┘ + ↓ + archived to deleted/ +``` + +### Basic Commands + +```bash +# Send email +drone @ai_mail send @recipient "Subject" "Message" + +# Send with dispatch (auto-execute at recipient) +drone @ai_mail send @recipient "Task" "Details" --dispatch + +# Broadcast to all branches +drone @ai_mail send @all "Announcement" "Message" + +# Check inbox (shows new + opened emails) +drone @ai_mail inbox + +# View email content (marks as opened) +drone @ai_mail view + +# Reply to email (sends reply + auto-closes original) +drone @ai_mail reply "Your reply message" + +# Close email without replying (archives to deleted) +drone @ai_mail close + +# View sent messages +drone @ai_mail sent + +# List contacts +drone @ai_mail contacts +``` + +### Backward Compatibility + +```bash +# 'read' command now behaves like 'view' +# (marks as opened, does NOT archive) +drone @ai_mail read +``` + +### Dispatch System (v3.0) + +The `--dispatch` flag marks emails for autonomous execution. The **dispatch daemon** polls inboxes and spawns agents — delivery.py is write-only. + +**Architecture:** +- `delivery.py` writes to inbox + sends desktop notification. No spawning. +- `daemon.py` polls all branch inboxes every 5 min for `--dispatch` emails +- Agents spawned via `claude -c -p` from the branch's CWD (auto-continues most recent session) +- Agents are ephemeral (wake, do work, exit). The daemon is the continuity. +- All safety limits configured in `safety_config.json` + +**Running the daemon:** +```bash +python3 apps/handlers/dispatch/daemon.py # Standalone +ai_mail dispatch daemon # Via module +tmux new-session -d -s dispatch 'python3 apps/handlers/dispatch/daemon.py' +``` + +**Safety features:** +- **Kill switch**: `touch /home/aipass/.aipass/autonomous_pause` freezes all dispatches +- **Max turns**: 15 per wake (configurable) +- **Max dispatches/branch/day**: 10 (configurable, resets at midnight) +- **Single instance lock**: PID-based `.dispatch.lock` prevents concurrent agents per branch +- **DEV_CENTRAL protection**: @dev_central is never auto-dispatched +- **Notification throttling**: Max 3 desktop notifications per recipient in 30s window +- **Stale lock timeout**: 10 minutes (auto-cleanup of dead locks) + +### Direct Module Access + +```bash +# Email operations +python3 apps/ai_mail.py email [command] + +# Branch health check +python3 apps/ai_mail.py ping + +# Dispatch status +python3 apps/ai_mail.py dispatch status + +# Start dispatch daemon +python3 apps/ai_mail.py dispatch daemon +``` ## Integration Points -### Depends On +**Depends On**: +- PRAX - Logging infrastructure +- CLI - Display and formatting +- DRONE - Command routing + +**Provides To**: +- All branches - Email communication +- AIPASS - System coordination + +## Memory System + +### Core Files +- `AI_MAIL.id.json` - Branch identity and architecture +- `AI_MAIL.local.json` - Session history (max 600 lines) +- `AI_MAIL.observations.json` - Collaboration patterns (max 600 lines) +- `AI_MAIL.ai_mail.json` - Email dashboard + +### Mailbox Structure +- `ai_mail.local/inbox.json` - Incoming messages (new + opened status) +- `ai_mail.local/sent/` - Sent messages (individual files, auto-purged at >10) +- `ai_mail.local/deleted/` - Closed/archived messages (individual files, auto-purged at >10) +- `ai_mail.local/.dispatch.lock` - PID-based dispatch lock (when agent active) +- `ai_mail.local/daemon_state.json` - Daemon daily counts and session tracking +- `ai_mail.local/dispatch_daemon.log` - Daemon activity log +- `safety_config.json` - Kill switch, poll interval, max turns/dispatches, autonomous branch list + +**Email Schema (v2):** +```json +{ + "id": "abc123", + "from": "@sender", + "from_name": "SENDER Branch", + "to": "@recipient", + "subject": "Subject line", + "message": "Message body", + "status": "new", // new | opened | closed + "timestamp": "2025-11-30 12:00:00", + "thread_id": null, // For future threading + "reply_to": null // Original message ID if reply +} +``` + +### Health Monitoring +- 🟢 **Healthy**: Under 80% of limits +- 🟡 **Warning**: 80-100% of limits +- 🔴 **Critical**: Over limits (compression needed) + +## Standards Compliance + +Seed audit score: **89%** (passing) + +Following AIPass code standards: +- 100% CLI integration +- Proper import patterns +- 3-layer architecture +- Handler independence +- Auto-discovery patterns + +## Development Notes + +- Code is truth - fail honestly +- Simple solutions over complex architecture +- Test incrementally, preserve what works +- Each instance isolated with own memory +- Never explain context again - memories persist + +--- -### Provides To - +*Last Updated: 2026-02-28* +*Maintained by: AI_MAIL Branch* diff --git a/src/aipass/ai_mail/ai_mail_json/branch_ping_config.json b/src/aipass/ai_mail/ai_mail_json/branch_ping_config.json new file mode 100644 index 00000000..f2586079 --- /dev/null +++ b/src/aipass/ai_mail/ai_mail_json/branch_ping_config.json @@ -0,0 +1,9 @@ +{ + "module_name": "branch_ping", + "version": "1.0.0", + "timestamp": "2025-11-13", + "config": { + "auto_save": true, + "enabled": true + } +} \ No newline at end of file diff --git a/src/aipass/ai_mail/ai_mail_json/branch_ping_data.json b/src/aipass/ai_mail/ai_mail_json/branch_ping_data.json new file mode 100644 index 00000000..1e5ca465 --- /dev/null +++ b/src/aipass/ai_mail/ai_mail_json/branch_ping_data.json @@ -0,0 +1,8 @@ +{ + "module_name": "branch_ping", + "created": "2025-11-13", + "last_updated": "2025-11-13", + "operations_total": 0, + "operations_successful": 0, + "operations_failed": 0 +} \ No newline at end of file diff --git a/src/aipass/ai_mail/ai_mail_json/branch_ping_log.json b/src/aipass/ai_mail/ai_mail_json/branch_ping_log.json new file mode 100644 index 00000000..41ce4c35 --- /dev/null +++ b/src/aipass/ai_mail/ai_mail_json/branch_ping_log.json @@ -0,0 +1,11 @@ +[ + { + "timestamp": "2026-03-06T20:33:19.802974", + "operation": "ping_executed", + "data": { + "branch": "AI_MAIL", + "local_count": 0, + "obs_count": 0 + } + } +] \ No newline at end of file diff --git a/src/aipass/ai_mail/ai_mail_json/local_memory_monitor_registry.json b/src/aipass/ai_mail/ai_mail_json/local_memory_monitor_registry.json new file mode 100644 index 00000000..4c863277 --- /dev/null +++ b/src/aipass/ai_mail/ai_mail_json/local_memory_monitor_registry.json @@ -0,0 +1,23 @@ +{ + "last_updated": "2026-03-06T20:33:19.797905", + "active_branches": { + "/home/coder/workspace/src/aipass/ai_mail": { + "branch_name": "AI_MAIL", + "last_ping": "2026-03-06T20:33:19.797892", + "local_md": { + "line_count": 0, + "status": "\ud83d\udfe2 Healthy" + }, + "observations_md": { + "line_count": 0, + "status": "\ud83d\udfe2 Healthy" + } + } + }, + "statistics": { + "total_branches": 1, + "green_status": 0, + "yellow_status": 0, + "red_status": 0 + } +} \ No newline at end of file diff --git a/src/aipass/ai_mail/apps/ai_mail.py b/src/aipass/ai_mail/apps/ai_mail.py index c7c47540..882a7437 100644 --- a/src/aipass/ai_mail/apps/ai_mail.py +++ b/src/aipass/ai_mail/apps/ai_mail.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/ai_mail/apps/handlers/__init__.py b/src/aipass/ai_mail/apps/handlers/__init__.py index 02e8b77f..fe5985f6 100755 --- a/src/aipass/ai_mail/apps/handlers/__init__.py +++ b/src/aipass/ai_mail/apps/handlers/__init__.py @@ -45,7 +45,7 @@ def _extract_branch_name(filepath: str) -> str: """Extract branch name from a file path.""" parts = filepath.split("/") for i, part in enumerate(parts): - if part in ("aipass_core", "MEMORY_BANK", "Nexus"): + if part in ("aipass", "MEMORY_BANK", "Nexus"): if i + 1 < len(parts): return parts[i + 1] return "unknown" diff --git a/src/aipass/ai_mail/apps/handlers/central_writer.py b/src/aipass/ai_mail/apps/handlers/central_writer.py index 3de45b1d..7bbbd879 100644 --- a/src/aipass/ai_mail/apps/handlers/central_writer.py +++ b/src/aipass/ai_mail/apps/handlers/central_writer.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -25,7 +24,7 @@ This file serves as AI_MAIL's API output for AIPASS dashboard integration. Architecture: - Scans all ai_mail.local/inbox.json files across the system - Calculates per-branch unread/total message counts -- Writes aggregated stats to /home/aipass/aipass_os/AI_CENTRAL/AI_MAIL.central.json +- Writes aggregated stats to AI_CENTRAL/AI_MAIL.central.json (under repo root) """ # CRITICAL: Use importlib to bypass local json/ directory and get stdlib json @@ -51,10 +50,19 @@ from typing import Dict, Any, List, Tuple # CONSTANTS # ============================================================================= -AIPASS_HOME = Path.home() # /home/aipass - scan from user home -AI_CENTRAL_DIR = Path.home() / "aipass_os" / "AI_CENTRAL" +def _find_repo_root() -> Path: + """Walk up from this file to find AIPASS_REGISTRY.json (repo root).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + + +_REPO_ROOT = _find_repo_root() +AI_CENTRAL_DIR = _REPO_ROOT / "aipass_os" / "AI_CENTRAL" CENTRAL_FILE = AI_CENTRAL_DIR / "AI_MAIL.central.json" -BRANCH_REGISTRY = Path.home() / "BRANCH_REGISTRY.json" +BRANCH_REGISTRY = _REPO_ROOT / "AIPASS_REGISTRY.json" # ============================================================================= @@ -65,7 +73,7 @@ def find_all_inbox_files() -> List[Path]: """ Find all inbox.json files in ai_mail.local directories. - Scans the entire /home/aipass directory for ai_mail.local/inbox.json files. + Scans the repo root directory for ai_mail.local/inbox.json files. Excludes backup directories to avoid counting archived data. Returns: @@ -77,7 +85,7 @@ def find_all_inbox_files() -> List[Path]: inbox_files = [] # Search pattern: any directory ending in ai_mail.local containing inbox.json - for ai_mail_dir in AIPASS_HOME.rglob("ai_mail.local"): + for ai_mail_dir in _REPO_ROOT.rglob("ai_mail.local"): # Skip backup/archive directories (but NOT backup_system branch itself) path_str = str(ai_mail_dir) if ".backup" in path_str or ".archive" in path_str or "/backups/" in path_str: @@ -94,10 +102,10 @@ def extract_branch_name(inbox_path: Path) -> str: """ Extract branch name from inbox.json path. - Given: /home/aipass/seed/ai_mail.local/inbox.json + Given: .../seed/ai_mail.local/inbox.json Returns: SEED - Given: /home/aipass/aipass_core/prax/ai_mail.local/inbox.json + Given: .../prax/ai_mail.local/inbox.json Returns: PRAX Args: @@ -275,7 +283,7 @@ def update_central() -> Dict[str, Any]: 1. Scans all branch ai_mail.local/inbox.json files 2. Aggregates unread and total message counts per branch 3. Calculates system-wide totals - 4. Writes results to /home/aipass/aipass_os/AI_CENTRAL/AI_MAIL.central.json + 4. Writes results to AI_CENTRAL/AI_MAIL.central.json (under repo root) Returns: The data written to central file (for logging/verification) diff --git a/src/aipass/ai_mail/apps/handlers/dispatch/daemon.py b/src/aipass/ai_mail/apps/handlers/dispatch/daemon.py index 1965c407..2fbf2e28 100644 --- a/src/aipass/ai_mail/apps/handlers/dispatch/daemon.py +++ b/src/aipass/ai_mail/apps/handlers/dispatch/daemon.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -49,19 +48,29 @@ from urllib.error import URLError from aipass.prax.apps.modules.logger import system_logger as logger + +def _find_repo_root() -> Path: + """Walk up from this file to find AIPASS_REGISTRY.json (repo root).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + + # Infrastructure paths -AIPASS_ROOT = Path.home() / "aipass_core" -AIPASS_HOME = Path.home() +_REPO_ROOT = _find_repo_root() +_AI_MAIL_DIR = Path(__file__).resolve().parents[3] # ai_mail/ # Paths -CONFIG_FILE = AIPASS_ROOT / "ai_mail" / "safety_config.json" -DAEMON_STATE_FILE = AIPASS_ROOT / "ai_mail" / "ai_mail.local" / "daemon_state.json" -DAEMON_LOG_FILE = AIPASS_ROOT / "ai_mail" / "ai_mail.local" / "dispatch_daemon.log" -DAEMON_PID_FILE = AIPASS_ROOT / "ai_mail" / "ai_mail.local" / "daemon.pid" -BRANCH_REGISTRY = AIPASS_HOME / "BRANCH_REGISTRY.json" +CONFIG_FILE = _AI_MAIL_DIR / "safety_config.json" +DAEMON_STATE_FILE = _AI_MAIL_DIR / "ai_mail.local" / "daemon_state.json" +DAEMON_LOG_FILE = _AI_MAIL_DIR / "ai_mail.local" / "dispatch_daemon.log" +DAEMON_PID_FILE = _AI_MAIL_DIR / "ai_mail.local" / "daemon.pid" +BRANCH_REGISTRY = _REPO_ROOT / "AIPASS_REGISTRY.json" # Telegram notifications (scheduler bot) -SCHEDULER_CONFIG = AIPASS_HOME / ".aipass" / "scheduler_config.json" +SCHEDULER_CONFIG = _REPO_ROOT / ".aipass" / "scheduler_config.json" # Graceful shutdown SHUTDOWN = False @@ -132,7 +141,7 @@ def _set_session_name(branch_path: Path, name: str) -> bool: Writing a custom-title entry makes the session identifiable in /resume picker. """ encoded_cwd = str(branch_path).replace("/", "-") - projects_dir = Path.home() / ".claude" / "projects" / encoded_cwd + projects_dir = Path("~/.claude/projects").expanduser() / encoded_cwd if not projects_dir.exists(): return False jsonl_files = sorted( @@ -226,7 +235,7 @@ def _acquire_lock(branch_path: Path, pid: int) -> tuple[bool, str]: def load_config() -> Dict[str, Any]: """Load safety config from JSON file.""" DEFAULTS = { - "kill_switch_path": str(AIPASS_HOME / ".aipass" / "autonomous_pause"), + "kill_switch_path": str(_REPO_ROOT / ".aipass" / "autonomous_pause"), "poll_interval_seconds": 300, "max_depth": 3, "max_turns_per_wake": 50, @@ -271,7 +280,7 @@ def save_daemon_state(state: Dict[str, Any]) -> None: def is_kill_switch_active(config: Dict[str, Any]) -> bool: """Check if the system-wide kill switch is engaged.""" - kill_path = Path(config.get("kill_switch_path", str(AIPASS_HOME / ".aipass" / "autonomous_pause"))) + kill_path = Path(config.get("kill_switch_path", str(_REPO_ROOT / ".aipass" / "autonomous_pause"))) return kill_path.exists() @@ -416,7 +425,7 @@ def spawn_agent( ] # Build monitor command (dispatch_monitor wraps claude, handles bounce + lock cleanup) - MONITOR_SCRIPT = AIPASS_ROOT / "ai_mail" / "apps" / "handlers" / "dispatch" / "dispatch_monitor.py" + MONITOR_SCRIPT = Path(__file__).resolve().parent / "dispatch_monitor.py" LOG_DIR = branch_path / "ai_mail.local" LOG_DIR.mkdir(parents=True, exist_ok=True) STDERR_LOG = str(LOG_DIR / "agent_stderr.log") diff --git a/src/aipass/ai_mail/apps/handlers/dispatch/dispatch_monitor.py b/src/aipass/ai_mail/apps/handlers/dispatch/dispatch_monitor.py index 6963c3e1..f23d2c26 100644 --- a/src/aipass/ai_mail/apps/handlers/dispatch/dispatch_monitor.py +++ b/src/aipass/ai_mail/apps/handlers/dispatch/dispatch_monitor.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/ai_mail/apps/handlers/dispatch/pending_work.py b/src/aipass/ai_mail/apps/handlers/dispatch/pending_work.py index 17124628..ecd3f886 100644 --- a/src/aipass/ai_mail/apps/handlers/dispatch/pending_work.py +++ b/src/aipass/ai_mail/apps/handlers/dispatch/pending_work.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -32,8 +31,8 @@ PENDING_WORK_FILENAME = ".pending_work.json" def _get_pending_path(branch_path: Path) -> Path: """Get the pending work file path for a branch.""" - if branch_path == Path("/") or branch_path == Path.home(): - return Path.home() / "ai_mail.local" / PENDING_WORK_FILENAME + if branch_path == Path("/"): + return Path.cwd() / "ai_mail.local" / PENDING_WORK_FILENAME return branch_path / "ai_mail.local" / PENDING_WORK_FILENAME diff --git a/src/aipass/ai_mail/apps/handlers/dispatch/status.py b/src/aipass/ai_mail/apps/handlers/dispatch/status.py index 584f223b..35e981bc 100644 --- a/src/aipass/ai_mail/apps/handlers/dispatch/status.py +++ b/src/aipass/ai_mail/apps/handlers/dispatch/status.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -28,9 +27,9 @@ from pathlib import Path from datetime import datetime from typing import Dict, Any, List, Optional -# Dispatch log location -AIPASS_ROOT = Path.home() / "aipass_core" -DISPATCH_LOG_FILE = AIPASS_ROOT / "ai_mail" / "ai_mail.local" / "dispatch_log.json" +# Dispatch log location (package-relative) +_AI_MAIL_DIR = Path(__file__).resolve().parents[3] # ai_mail/ +DISPATCH_LOG_FILE = _AI_MAIL_DIR / "ai_mail.local" / "dispatch_log.json" def load_dispatch_log() -> List[Dict[str, Any]]: diff --git a/src/aipass/ai_mail/apps/handlers/dispatch/wake.py b/src/aipass/ai_mail/apps/handlers/dispatch/wake.py index a7ab080b..eb0d4d17 100644 --- a/src/aipass/ai_mail/apps/handlers/dispatch/wake.py +++ b/src/aipass/ai_mail/apps/handlers/dispatch/wake.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -41,12 +40,22 @@ from typing import Optional, Tuple, List from aipass.prax.apps.modules.logger import system_logger as logger + +def _find_repo_root() -> Path: + """Walk up from this file to find AIPASS_REGISTRY.json (repo root).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + + # Infrastructure paths -AIPASS_ROOT = Path.home() / "aipass_core" -AIPASS_HOME = Path.home() -CONFIG_FILE = AIPASS_ROOT / "ai_mail" / "safety_config.json" -BRANCH_REGISTRY = AIPASS_HOME / "BRANCH_REGISTRY.json" -PAUSE_FILE = AIPASS_HOME / ".aipass" / "autonomous_pause" +_REPO_ROOT = _find_repo_root() +_AI_MAIL_DIR = Path(__file__).resolve().parents[3] # ai_mail/ +CONFIG_FILE = _AI_MAIL_DIR / "safety_config.json" +BRANCH_REGISTRY = _REPO_ROOT / "AIPASS_REGISTRY.json" +PAUSE_FILE = _REPO_ROOT / ".aipass" / "autonomous_pause" MONITOR_SCRIPT = Path(__file__).parent / "dispatch_monitor.py" # Default prompt when no custom message provided @@ -182,7 +191,7 @@ def _load_config() -> dict: def _set_session_name(branch_path: Path, name: str) -> bool: """Write custom-title to the most recent Claude session JSONL for a branch.""" encoded_cwd = str(branch_path).replace("/", "-") - projects_dir = Path.home() / ".claude" / "projects" / encoded_cwd + projects_dir = Path("~/.claude/projects").expanduser() / encoded_cwd if not projects_dir.exists(): return False jsonl_files = sorted( diff --git a/src/aipass/ai_mail/apps/handlers/email/create.py b/src/aipass/ai_mail/apps/handlers/email/create.py index fc29afdd..0352906e 100644 --- a/src/aipass/ai_mail/apps/handlers/email/create.py +++ b/src/aipass/ai_mail/apps/handlers/email/create.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/ai_mail/apps/handlers/email/dashboard_sync.py b/src/aipass/ai_mail/apps/handlers/email/dashboard_sync.py index de5f5020..a2d4cddb 100644 --- a/src/aipass/ai_mail/apps/handlers/email/dashboard_sync.py +++ b/src/aipass/ai_mail/apps/handlers/email/dashboard_sync.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -171,8 +170,8 @@ def push_dashboard_update(branch_path: Path) -> bool: branch_path = Path(branch_path) # Determine inbox path - if branch_path == Path("/") or branch_path == Path.home(): - inbox_file = Path.home() / "ai_mail.local" / "inbox.json" + if branch_path == Path("/"): + inbox_file = Path.cwd() / "ai_mail.local" / "inbox.json" else: inbox_file = branch_path / "ai_mail.local" / "inbox.json" diff --git a/src/aipass/ai_mail/apps/handlers/email/delivery.py b/src/aipass/ai_mail/apps/handlers/email/delivery.py index 4ce7fedc..860aae8d 100644 --- a/src/aipass/ai_mail/apps/handlers/email/delivery.py +++ b/src/aipass/ai_mail/apps/handlers/email/delivery.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -36,6 +35,18 @@ from typing import Dict, Tuple, List, Optional, Callable from aipass.ai_mail.apps.handlers.json_utils.json_handler import load_json, save_json + +def _find_repo_root() -> Path: + """Walk up from this file to find AIPASS_REGISTRY.json (repo root).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + + +_REPO_ROOT = _find_repo_root() + # Lazy imports to avoid circular dependencies _CONSOLE = None _INBOX_LOCK = None @@ -62,13 +73,13 @@ def _get_console(): def get_all_branches() -> List[Dict]: """ Get list of all branches for email routing. - Reads from AIPass branch registry at /home/aipass/BRANCH_REGISTRY.json + Reads from AIPass branch registry (AIPASS_REGISTRY.json at repo root). Returns: List of dicts with branch info: [{"name": "AIPASS.admin", "path": "/", "email": "@admin"}, ...] """ - registry_file = Path("/home/aipass/BRANCH_REGISTRY.json") + registry_file = _REPO_ROOT / "AIPASS_REGISTRY.json" branches = [] if not registry_file.exists(): @@ -198,7 +209,7 @@ def _is_private_branch_email(email: str) -> bool: Returns: True if email belongs to a private branch, False otherwise """ - registry_path = Path.home() / "PRIVATE_BRANCH_REGISTRY.json" + registry_path = _REPO_ROOT / "PRIVATE_BRANCH_REGISTRY.json" if not registry_path.exists(): return False try: @@ -273,8 +284,8 @@ def deliver_email_to_branch( branch_path = Path(branches[to_branch]) # Find the branch's ai_mail.local/inbox.json file - if branch_path == Path("/") or branch_path == Path.home(): - inbox_file = Path.home() / "ai_mail.local" / "inbox.json" + if branch_path == Path("/") or branch_path == _REPO_ROOT: + inbox_file = _REPO_ROOT / "ai_mail.local" / "inbox.json" else: inbox_file = branch_path / "ai_mail.local" / "inbox.json" @@ -364,7 +375,7 @@ def _get_summary_file_path(branch_path: Path) -> Path: Get the summary file path for a branch. Pattern: [BRANCH_NAME].ai_mail.json - Example: /home/aipass/aipass_core/drone/DRONE.ai_mail.json + Example: src/aipass/drone/DRONE.ai_mail.json Args: branch_path: Path to branch directory @@ -374,7 +385,7 @@ def _get_summary_file_path(branch_path: Path) -> Path: """ branch_name = branch_path.name.upper() - if branch_path == Path("/") or branch_path == Path.home(): + if branch_path == Path("/") or branch_path == _REPO_ROOT: branch_name = "AIPASS" summary_file = branch_path / f"{branch_name}.ai_mail.json" diff --git a/src/aipass/ai_mail/apps/handlers/email/footer.py b/src/aipass/ai_mail/apps/handlers/email/footer.py index 73c9567f..8c79a2f1 100644 --- a/src/aipass/ai_mail/apps/handlers/email/footer.py +++ b/src/aipass/ai_mail/apps/handlers/email/footer.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/ai_mail/apps/handlers/email/format.py b/src/aipass/ai_mail/apps/handlers/email/format.py index 193a25ab..5452df7f 100644 --- a/src/aipass/ai_mail/apps/handlers/email/format.py +++ b/src/aipass/ai_mail/apps/handlers/email/format.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -31,7 +30,16 @@ from typing import Dict, Optional from aipass.prax.apps.modules.logger import system_logger as logger from aipass.cli.apps.modules import console -REGISTRY_PATH = Path.home() / "BRANCH_REGISTRY.json" +def _find_repo_root() -> Path: + """Walk up from this file to find AIPASS_REGISTRY.json (repo root).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + + +REGISTRY_PATH = _find_repo_root() / "AIPASS_REGISTRY.json" def lookup_branch_alias(branch_name: str) -> Optional[str]: diff --git a/src/aipass/ai_mail/apps/handlers/email/header.py b/src/aipass/ai_mail/apps/handlers/email/header.py index 16d3b037..a0198136 100644 --- a/src/aipass/ai_mail/apps/handlers/email/header.py +++ b/src/aipass/ai_mail/apps/handlers/email/header.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 from pathlib import Path diff --git a/src/aipass/ai_mail/apps/handlers/email/inbox_cleanup.py b/src/aipass/ai_mail/apps/handlers/email/inbox_cleanup.py index 9160f22d..ceda2ed0 100644 --- a/src/aipass/ai_mail/apps/handlers/email/inbox_cleanup.py +++ b/src/aipass/ai_mail/apps/handlers/email/inbox_cleanup.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -57,8 +56,11 @@ def _get_console() -> Any: def _get_update_section() -> Any: """Lazy import update_section.""" - from aipass.dev_central.devpulse.apps.modules.dashboard import update_section - return update_section + try: + from aipass.devpulse.apps.modules.dashboard import update_section + return update_section + except ImportError: + return None def _get_push_dashboard_update() -> Any: diff --git a/src/aipass/ai_mail/apps/handlers/email/inbox_lock.py b/src/aipass/ai_mail/apps/handlers/email/inbox_lock.py index 34d40024..db757e76 100644 --- a/src/aipass/ai_mail/apps/handlers/email/inbox_lock.py +++ b/src/aipass/ai_mail/apps/handlers/email/inbox_lock.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/ai_mail/apps/handlers/email/inbox_ops.py b/src/aipass/ai_mail/apps/handlers/email/inbox_ops.py index 7837b706..052f00eb 100644 --- a/src/aipass/ai_mail/apps/handlers/email/inbox_ops.py +++ b/src/aipass/ai_mail/apps/handlers/email/inbox_ops.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/ai_mail/apps/handlers/email/lock_utils.py b/src/aipass/ai_mail/apps/handlers/email/lock_utils.py index dce7889f..f4cd2eff 100644 --- a/src/aipass/ai_mail/apps/handlers/email/lock_utils.py +++ b/src/aipass/ai_mail/apps/handlers/email/lock_utils.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -41,8 +40,8 @@ STALE_LOCK_TIMEOUT = 600 def _get_lock_path(branch_path: Path) -> Path: """Get the lock file path for a branch.""" - if branch_path == Path("/") or branch_path == Path.home(): - return Path.home() / "ai_mail.local" / LOCK_FILENAME + if branch_path == Path("/"): + return Path.cwd() / "ai_mail.local" / LOCK_FILENAME return branch_path / "ai_mail.local" / LOCK_FILENAME diff --git a/src/aipass/ai_mail/apps/handlers/email/purge.py b/src/aipass/ai_mail/apps/handlers/email/purge.py index 54007593..124abd97 100644 --- a/src/aipass/ai_mail/apps/handlers/email/purge.py +++ b/src/aipass/ai_mail/apps/handlers/email/purge.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -42,9 +41,19 @@ from aipass.prax.apps.modules.logger import system_logger as logger # Purge configuration MAX_EMAILS = 10 -# Memory Bank paths for subprocess vectorization -MEMORY_BANK_PYTHON = Path.home() / "MEMORY_BANK" / ".venv" / "bin" / "python3" -CHROMA_SUBPROCESS_SCRIPT = Path.home() / "MEMORY_BANK" / "apps" / "handlers" / "storage" / "chroma_subprocess.py" +# Memory Bank paths for subprocess vectorization (optional external service) +# These are resolved relative to repo root if available; vectorization is best-effort +def _find_repo_root() -> Path: + """Walk up from this file to find AIPASS_REGISTRY.json (repo root).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + +_REPO_ROOT = _find_repo_root() +MEMORY_BANK_PYTHON = _REPO_ROOT / "MEMORY_BANK" / ".venv" / "bin" / "python3" +CHROMA_SUBPROCESS_SCRIPT = _REPO_ROOT / "MEMORY_BANK" / "apps" / "handlers" / "storage" / "chroma_subprocess.py" def purge_sent_folder(mailbox_path: Path) -> Dict[str, Any]: diff --git a/src/aipass/ai_mail/apps/handlers/email/reply.py b/src/aipass/ai_mail/apps/handlers/email/reply.py index 2e33cc5a..df20883d 100644 --- a/src/aipass/ai_mail/apps/handlers/email/reply.py +++ b/src/aipass/ai_mail/apps/handlers/email/reply.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -97,7 +96,7 @@ def send_reply( # Normalize dispatched_to to email format if it's a path # DRONE's preprocess_args converts @branch to paths, so we may receive - # "/home/aipass/aipass_core/trigger" instead of "@trigger" + # a filesystem path instead of "@trigger" if dispatched_to and not dispatched_to.startswith('@'): # It's a path - look up email in registry dispatch_info = get_branch_info_from_registry(Path(dispatched_to)) diff --git a/src/aipass/ai_mail/apps/handlers/json/json_handler.py b/src/aipass/ai_mail/apps/handlers/json/json_handler.py index 9970d4bb..fa52c55c 100644 --- a/src/aipass/ai_mail/apps/handlers/json/json_handler.py +++ b/src/aipass/ai_mail/apps/handlers/json/json_handler.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -24,10 +23,9 @@ the Seed architecture standard requiring apps/handlers/json/json_handler.py. from pathlib import Path -# Infrastructure paths -AIPASS_ROOT = Path.home() / "aipass_core" -AI_MAIL_ROOT = Path.home() / "aipass_core" / "ai_mail" -AI_MAIL_JSON_DIR = AI_MAIL_ROOT / "ai_mail_json" +# Infrastructure paths (package-relative) +_AI_MAIL_ROOT = Path(__file__).resolve().parents[3] # ai_mail/ +AI_MAIL_JSON_DIR = _AI_MAIL_ROOT / "ai_mail_json" from aipass.ai_mail.apps.handlers.json_utils.json_handler import ( # noqa: F401 load_json, diff --git a/src/aipass/ai_mail/apps/handlers/json_utils/json_handler.py b/src/aipass/ai_mail/apps/handlers/json_utils/json_handler.py index a21997c4..fa97f5de 100644 --- a/src/aipass/ai_mail/apps/handlers/json_utils/json_handler.py +++ b/src/aipass/ai_mail/apps/handlers/json_utils/json_handler.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -29,13 +28,12 @@ from datetime import datetime from typing import Dict, List, Any, Optional import inspect -# Infrastructure paths -AIPASS_ROOT = Path.home() / "aipass_core" +# Infrastructure paths (package-relative) +_AI_MAIL_ROOT = Path(__file__).resolve().parents[3] # ai_mail/ # Constants - Updated for AI_MAIL -AI_MAIL_ROOT = AIPASS_ROOT / "ai_mail" -AI_MAIL_JSON_DIR = AI_MAIL_ROOT / "ai_mail_json" -JSON_TEMPLATES_DIR = AI_MAIL_ROOT / "apps" / "json_templates" +AI_MAIL_JSON_DIR = _AI_MAIL_ROOT / "ai_mail_json" +JSON_TEMPLATES_DIR = _AI_MAIL_ROOT / "apps" / "json_templates" def _get_caller_module_name() -> str: @@ -271,7 +269,7 @@ if __name__ == "__main__": increment_counter("ai_mail", "test_counter", 1) update_data_metrics("ai_mail", test_metric="working") - print("\nCheck /home/aipass/aipass_core/ai_mail/ai_mail_json/ for created files:") + print(f"\nCheck {AI_MAIL_JSON_DIR}/ for created files:") print(" - ai_mail_config.json") print(" - ai_mail_data.json") print(" - ai_mail_log.json") diff --git a/src/aipass/ai_mail/apps/handlers/monitoring/data_ops.py b/src/aipass/ai_mail/apps/handlers/monitoring/data_ops.py index 058ee868..6bb39434 100644 --- a/src/aipass/ai_mail/apps/handlers/monitoring/data_ops.py +++ b/src/aipass/ai_mail/apps/handlers/monitoring/data_ops.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/ai_mail/apps/handlers/monitoring/errors.py b/src/aipass/ai_mail/apps/handlers/monitoring/errors.py index 4196aa40..acb1c579 100644 --- a/src/aipass/ai_mail/apps/handlers/monitoring/errors.py +++ b/src/aipass/ai_mail/apps/handlers/monitoring/errors.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -37,6 +36,18 @@ from typing import Optional, Dict, Tuple from aipass.cli.apps.modules import console + +def _find_repo_root() -> Path: + """Walk up from this file to find AIPASS_REGISTRY.json (repo root).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + + +_REPO_ROOT = _find_repo_root() + # ============================================= # CONSTANTS # ============================================= @@ -108,18 +119,18 @@ def get_branch_from_log_path(log_file_path: str) -> Tuple[str, Path]: Extract branch name and root path from log file path Args: - log_file_path: Full path to log file (e.g., /home/aipass/api/logs/openrouter.log) + log_file_path: Full path to log file (e.g., .../api/logs/openrouter.log) Returns: Tuple of (branch_name, branch_root_path) - Example: ("API", Path("/home/aipass/api")) + Example: ("API", Path(".../api")) Special case: root directory returns ("AIPASS.admin", Path("/")) """ log_path = Path(log_file_path) # Navigate up from log file to branch root - # /home/aipass/api/logs/openrouter.log -> /home/aipass/api + # .../api/logs/openrouter.log -> .../api branch_root = log_path.parent.parent # Special case: root directory @@ -127,8 +138,8 @@ def get_branch_from_log_path(log_file_path: str) -> Tuple[str, Path]: return "AIPASS.admin", branch_root # Extract branch name from directory name - # /home/aipass/api -> "API" - # /home/aipass/backup-system -> "BACKUP_SYSTEM" + # .../api -> "API" + # .../backup-system -> "BACKUP_SYSTEM" branch_folder = branch_root.name.replace("-", "_") branch_name = branch_folder.upper() @@ -186,7 +197,7 @@ def format_error_email(error_hash: str, error_info: Dict, branch_name: str) -> s Returns: Formatted email message """ - branch_root = Path.home() / "aipass_core" / branch_name.lower() + branch_root = _REPO_ROOT / "src" / "aipass" / branch_name.lower() logs_dir = branch_root / "logs" message = f"""Error detected in {branch_name} logs diff --git a/src/aipass/ai_mail/apps/handlers/monitoring/memory.py b/src/aipass/ai_mail/apps/handlers/monitoring/memory.py index 1e8ff1d4..a9a0b1ef 100644 --- a/src/aipass/ai_mail/apps/handlers/monitoring/memory.py +++ b/src/aipass/ai_mail/apps/handlers/monitoring/memory.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/ai_mail/apps/handlers/persistence/json_ops.py b/src/aipass/ai_mail/apps/handlers/persistence/json_ops.py index 0e903e97..ad6e7333 100644 --- a/src/aipass/ai_mail/apps/handlers/persistence/json_ops.py +++ b/src/aipass/ai_mail/apps/handlers/persistence/json_ops.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ============================================= # META DATA HEADER @@ -31,13 +30,12 @@ from datetime import datetime from typing import Dict, List, Any, Optional import inspect -# Infrastructure paths -AIPASS_ROOT = Path.home() / "aipass_core" +# Infrastructure paths (package-relative) +_AI_MAIL_ROOT = Path(__file__).resolve().parents[3] # ai_mail/ # Constants -AI_MAIL_ROOT = AIPASS_ROOT / "ai_mail" -AI_MAIL_JSON_DIR = AI_MAIL_ROOT / "ai_mail_json" -JSON_TEMPLATES_DIR = AI_MAIL_ROOT / "apps" / "json_templates" +AI_MAIL_JSON_DIR = _AI_MAIL_ROOT / "ai_mail_json" +JSON_TEMPLATES_DIR = _AI_MAIL_ROOT / "apps" / "json_templates" def _get_caller_module_name() -> str: diff --git a/src/aipass/ai_mail/apps/handlers/registry/load.py b/src/aipass/ai_mail/apps/handlers/registry/load.py index e436a1a5..817e1997 100644 --- a/src/aipass/ai_mail/apps/handlers/registry/load.py +++ b/src/aipass/ai_mail/apps/handlers/registry/load.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/ai_mail/apps/handlers/registry/read.py b/src/aipass/ai_mail/apps/handlers/registry/read.py index 06ce8573..5568962d 100644 --- a/src/aipass/ai_mail/apps/handlers/registry/read.py +++ b/src/aipass/ai_mail/apps/handlers/registry/read.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -38,13 +37,24 @@ from aipass.cli.apps.modules import console # Constants MODULE_NAME = "registry.read" -BRANCH_REGISTRY_PATH = Path("/home/aipass/BRANCH_REGISTRY.json") + + +def _find_repo_root() -> Path: + """Walk up from this file to find AIPASS_REGISTRY.json (repo root).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + + +BRANCH_REGISTRY_PATH = _find_repo_root() / "AIPASS_REGISTRY.json" def get_all_branches() -> List[Dict]: """ Get list of all branches for email selection. - Reads from AIPass branch registry at /home/aipass/BRANCH_REGISTRY.json + Reads from AIPass branch registry (AIPASS_REGISTRY.json at repo root) Returns: List of dicts with branch info: @@ -155,7 +165,7 @@ def get_branch_path_map() -> Dict[str, str]: Returns: Dict mapping email -> path - Example: {"@admin": "/", "@flow": "/home/aipass/flow"} + Example: {"@admin": "/", "@flow": "src/aipass/flow"} """ branches = get_all_branches() return {branch["email"]: branch["path"] for branch in branches} diff --git a/src/aipass/ai_mail/apps/handlers/registry/update.py b/src/aipass/ai_mail/apps/handlers/registry/update.py index 97567909..ecfadcb2 100644 --- a/src/aipass/ai_mail/apps/handlers/registry/update.py +++ b/src/aipass/ai_mail/apps/handlers/registry/update.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -39,9 +38,8 @@ from aipass.cli.apps.modules import console # Constants MODULE_NAME = "registry.update" -AIPASS_ROOT = Path.home() / "aipass_core" -AI_MAIL_ROOT = AIPASS_ROOT / "ai_mail" -AI_MAIL_JSON = AI_MAIL_ROOT / "ai_mail_json" +_AI_MAIL_ROOT = Path(__file__).resolve().parents[3] # ai_mail/ +AI_MAIL_JSON = _AI_MAIL_ROOT / "ai_mail_json" REGISTRY_PATH = AI_MAIL_JSON / "local_memory_monitor_registry.json" THRESHOLDS = { "green": (0, 400), diff --git a/src/aipass/ai_mail/apps/handlers/registry/validate.py b/src/aipass/ai_mail/apps/handlers/registry/validate.py index bc06bf14..eef00493 100644 --- a/src/aipass/ai_mail/apps/handlers/registry/validate.py +++ b/src/aipass/ai_mail/apps/handlers/registry/validate.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -235,8 +234,8 @@ if __name__ == "__main__": # Sample test data test_branches = [ {"name": "AIPASS.admin", "path": "/", "email": "@admin"}, - {"name": "FLOW", "path": "/home/aipass/flow", "email": "@flow"}, - {"name": "DRONE", "path": "/home/aipass/drone", "email": "@drone"}, + {"name": "FLOW", "path": "src/aipass/flow", "email": "@flow"}, + {"name": "DRONE", "path": "src/aipass/drone", "email": "@drone"}, ] has_collisions, collisions = check_email_collisions(test_branches) diff --git a/src/aipass/ai_mail/apps/handlers/trigger/__init__.py b/src/aipass/ai_mail/apps/handlers/trigger/__init__.py index 3cdd4ed3..8f5db295 100644 --- a/src/aipass/ai_mail/apps/handlers/trigger/__init__.py +++ b/src/aipass/ai_mail/apps/handlers/trigger/__init__.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/ai_mail/apps/handlers/trigger/error_handler.py b/src/aipass/ai_mail/apps/handlers/trigger/error_handler.py index 423aa383..65f07b38 100644 --- a/src/aipass/ai_mail/apps/handlers/trigger/error_handler.py +++ b/src/aipass/ai_mail/apps/handlers/trigger/error_handler.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/ai_mail/apps/handlers/users/branch_detection.py b/src/aipass/ai_mail/apps/handlers/users/branch_detection.py index 0b9feecc..e2b713d5 100644 --- a/src/aipass/ai_mail/apps/handlers/users/branch_detection.py +++ b/src/aipass/ai_mail/apps/handlers/users/branch_detection.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python3 # ============================================= # META DATA HEADER @@ -34,7 +33,16 @@ from typing import Dict # ============================================= # CONSTANTS # ============================================= -BRANCH_REGISTRY_PATH = Path.home() / "BRANCH_REGISTRY.json" +def _find_repo_root() -> Path: + """Walk up from this file to find AIPASS_REGISTRY.json (repo root).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + + +BRANCH_REGISTRY_PATH = _find_repo_root() / "AIPASS_REGISTRY.json" # ============================================= # BRANCH DETECTION FUNCTIONS @@ -51,7 +59,7 @@ def detect_branch_from_pwd() -> Dict | None: Dict with branch info if detected: { "name": "SEED", - "path": "/home/aipass/seed", + "path": "src/aipass/seedgo", "email": "@seed", "display_name": "Seed (Standards Branch)", ... @@ -83,7 +91,7 @@ def find_branch_root(start_path: Path) -> Path | None: Walk up directory tree to find branch root. Branch root = directory containing a [BRANCH_NAME].id.json file. - Example: /home/aipass/seed/ contains SEED.id.json + Example: src/aipass/seedgo/ contains SEED.id.json Args: start_path: Directory to start searching from (usually PWD) diff --git a/src/aipass/ai_mail/apps/handlers/users/config_generator.py b/src/aipass/ai_mail/apps/handlers/users/config_generator.py index 21f1f857..0b57009c 100644 --- a/src/aipass/ai_mail/apps/handlers/users/config_generator.py +++ b/src/aipass/ai_mail/apps/handlers/users/config_generator.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python3 # ============================================= # META DATA HEADER diff --git a/src/aipass/ai_mail/apps/handlers/users/load.py b/src/aipass/ai_mail/apps/handlers/users/load.py index a04deae0..0bdfa1f2 100644 --- a/src/aipass/ai_mail/apps/handlers/users/load.py +++ b/src/aipass/ai_mail/apps/handlers/users/load.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python3 # ============================================= # META DATA HEADER @@ -35,9 +34,8 @@ from typing import Dict # ============================================= # CONSTANTS # ============================================= -AIPASS_ROOT = Path.home() / "aipass_core" -AI_MAIL_ROOT = AIPASS_ROOT / "ai_mail" -AI_MAIL_JSON = AI_MAIL_ROOT / "ai_mail_json" +_AI_MAIL_ROOT = Path(__file__).resolve().parents[3] # ai_mail/ +AI_MAIL_JSON = _AI_MAIL_ROOT / "ai_mail_json" USER_CONFIG_FILE = AI_MAIL_JSON / "user_config.json" # Import branch detection (after constants defined) diff --git a/src/aipass/ai_mail/apps/handlers/users/user.py b/src/aipass/ai_mail/apps/handlers/users/user.py index 05b22482..32438df4 100644 --- a/src/aipass/ai_mail/apps/handlers/users/user.py +++ b/src/aipass/ai_mail/apps/handlers/users/user.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python3 # ============================================= # META DATA HEADER @@ -106,7 +105,8 @@ def get_user_by_email(email: str) -> Dict | None: from .branch_detection import get_branch_info_from_registry # Use registry lookup - registry_path = Path.home() / "BRANCH_REGISTRY.json" + from .branch_detection import BRANCH_REGISTRY_PATH + registry_path = BRANCH_REGISTRY_PATH if not registry_path.exists(): return None @@ -136,7 +136,8 @@ def get_all_users() -> Dict[str, Dict]: Returns: Dict mapping branch emails to user info dicts """ - registry_path = Path.home() / "BRANCH_REGISTRY.json" + from .branch_detection import BRANCH_REGISTRY_PATH + registry_path = BRANCH_REGISTRY_PATH if not registry_path.exists(): return {} diff --git a/src/aipass/ai_mail/apps/modules/branch_ping.py b/src/aipass/ai_mail/apps/modules/branch_ping.py index 4caa6364..409208d1 100644 --- a/src/aipass/ai_mail/apps/modules/branch_ping.py +++ b/src/aipass/ai_mail/apps/modules/branch_ping.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/ai_mail/apps/modules/dispatch.py b/src/aipass/ai_mail/apps/modules/dispatch.py index dcf44b3e..1da7e50f 100644 --- a/src/aipass/ai_mail/apps/modules/dispatch.py +++ b/src/aipass/ai_mail/apps/modules/dispatch.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -57,7 +56,7 @@ DAEMON: Run as: ai_mail dispatch daemon Or standalone: python3 apps/handlers/dispatch/daemon.py - Kill switch: touch /home/aipass/.aipass/autonomous_pause + Kill switch: touch /.aipass/autonomous_pause Config: safety_config.json EXAMPLE: diff --git a/src/aipass/ai_mail/apps/modules/email.py b/src/aipass/ai_mail/apps/modules/email.py index 0302083a..c9caea80 100644 --- a/src/aipass/ai_mail/apps/modules/email.py +++ b/src/aipass/ai_mail/apps/modules/email.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -39,15 +38,23 @@ import argparse from pathlib import Path from typing import List -# Infrastructure -AIPASS_ROOT = Path.home() / "aipass_core" +# Infrastructure (package-relative) +_AI_MAIL_DIR = Path(__file__).resolve().parents[2] # ai_mail/ from aipass.prax.apps.modules.logger import system_logger as logger from aipass.cli.apps.modules import console -from aipass.ai_mail.apps.handlers.central_writer import update_central -from aipass.dev_central.devpulse.apps.modules.dashboard import update_section as _update_dashboard_section from aipass.ai_mail.apps.handlers.email.dashboard_sync import push_dashboard_update +try: + from aipass.ai_mail.apps.handlers.central_writer import update_central +except ImportError: + update_central = None + +try: + from aipass.devpulse.apps.modules.dashboard import update_section as _update_dashboard_section +except ImportError: + _update_dashboard_section = None + # Import handlers (business logic providers) from aipass.ai_mail.apps.handlers.email.delivery import deliver_email_to_branch from aipass.ai_mail.apps.handlers.email.create import create_email_file, load_email_file @@ -300,7 +307,7 @@ def handle_send(args: List[str]) -> bool: if a.startswith('@') and not rest: recipients.append(a) elif a.startswith('/') and not rest: - # Path-based recipient (e.g., /home/aipass/...) + # Path-based recipient (e.g., /path/to/branch) recipients.append(a) else: rest.append(a) @@ -459,7 +466,7 @@ def send_email_direct(to_branch: str, subject: str, message: str, auto_execute: user_info = { "email_address": email_addr, "display_name": branch_name, - "mailbox_path": str(AIPASS_ROOT / from_branch.lstrip('@').lower() / "ai_mail.local"), + "mailbox_path": str(_AI_MAIL_DIR.parent / from_branch.lstrip('@').lower() / "ai_mail.local"), "timestamp_format": "%Y-%m-%d %H:%M:%S" } else: diff --git a/src/aipass/ai_mail/tests/conftest.py b/src/aipass/ai_mail/tests/conftest.py index a87088fd..3cccc54b 100644 --- a/src/aipass/ai_mail/tests/conftest.py +++ b/src/aipass/ai_mail/tests/conftest.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/api/api_json/api_config.json b/src/aipass/api/api_json/api_config.json new file mode 100644 index 00000000..fbf5686d --- /dev/null +++ b/src/aipass/api/api_json/api_config.json @@ -0,0 +1,9 @@ +{ + "module_name": "api", + "version": "1.0.0", + "timestamp": "2025-11-13", + "config": { + "auto_save": true, + "enabled": true + } +} \ No newline at end of file diff --git a/src/aipass/api/api_json/api_data.json b/src/aipass/api/api_json/api_data.json new file mode 100644 index 00000000..32dac852 --- /dev/null +++ b/src/aipass/api/api_json/api_data.json @@ -0,0 +1,8 @@ +{ + "module_name": "api", + "created": "2025-11-13", + "last_updated": "2025-11-13", + "operations_total": 0, + "operations_successful": 0, + "operations_failed": 0 +} \ No newline at end of file diff --git a/src/aipass/api/api_json/api_key_config.json b/src/aipass/api/api_json/api_key_config.json new file mode 100644 index 00000000..961ba59b --- /dev/null +++ b/src/aipass/api/api_json/api_key_config.json @@ -0,0 +1,9 @@ +{ + "module_name": "api_key", + "version": "1.0.0", + "timestamp": "2025-11-13", + "config": { + "auto_save": true, + "enabled": true + } +} \ No newline at end of file diff --git a/src/aipass/api/api_json/api_key_data.json b/src/aipass/api/api_json/api_key_data.json new file mode 100644 index 00000000..b0741597 --- /dev/null +++ b/src/aipass/api/api_json/api_key_data.json @@ -0,0 +1,8 @@ +{ + "module_name": "api_key", + "created": "2025-11-13", + "last_updated": "2025-11-13", + "operations_total": 0, + "operations_successful": 0, + "operations_failed": 0 +} \ No newline at end of file diff --git a/src/aipass/api/api_json/api_key_log.json b/src/aipass/api/api_json/api_key_log.json new file mode 100644 index 00000000..64239f97 --- /dev/null +++ b/src/aipass/api/api_json/api_key_log.json @@ -0,0 +1,16 @@ +[ + { + "timestamp": "2026-03-06T19:26:31.512349", + "operation": "api_key_get-key", + "data": { + "command": "get-key" + } + }, + { + "timestamp": "2026-03-06T19:26:38.756413", + "operation": "api_key_validate", + "data": { + "command": "validate" + } + } +] \ No newline at end of file diff --git a/src/aipass/api/api_json/api_log.json b/src/aipass/api/api_json/api_log.json new file mode 100644 index 00000000..53ebbe84 --- /dev/null +++ b/src/aipass/api/api_json/api_log.json @@ -0,0 +1,55 @@ +[ + { + "timestamp": "2026-03-06T19:25:27.817286", + "operation": "api_help_displayed", + "data": { + "trigger": "--help" + } + }, + { + "timestamp": "2026-03-06T19:25:57.579810", + "operation": "api_command_attempted", + "data": { + "command": "test", + "modules_discovered": 4 + } + }, + { + "timestamp": "2026-03-06T19:26:31.498902", + "operation": "api_command_attempted", + "data": { + "command": "get-key", + "modules_discovered": 4 + } + }, + { + "timestamp": "2026-03-06T19:26:38.745089", + "operation": "api_command_attempted", + "data": { + "command": "validate", + "modules_discovered": 4 + } + }, + { + "timestamp": "2026-03-06T19:26:41.953458", + "operation": "api_command_attempted", + "data": { + "command": "stats", + "modules_discovered": 4 + } + }, + { + "timestamp": "2026-03-06T20:37:07.497952", + "operation": "api_help_displayed", + "data": { + "trigger": "--help" + } + }, + { + "timestamp": "2026-03-06T20:38:04.859299", + "operation": "api_help_displayed", + "data": { + "trigger": "--help" + } + } +] \ No newline at end of file diff --git a/src/aipass/api/api_json/usage_tracker_config.json b/src/aipass/api/api_json/usage_tracker_config.json new file mode 100644 index 00000000..522546d9 --- /dev/null +++ b/src/aipass/api/api_json/usage_tracker_config.json @@ -0,0 +1,9 @@ +{ + "module_name": "usage_tracker", + "version": "1.0.0", + "timestamp": "2025-11-13", + "config": { + "auto_save": true, + "enabled": true + } +} \ No newline at end of file diff --git a/src/aipass/api/api_json/usage_tracker_data.json b/src/aipass/api/api_json/usage_tracker_data.json new file mode 100644 index 00000000..fb272849 --- /dev/null +++ b/src/aipass/api/api_json/usage_tracker_data.json @@ -0,0 +1,8 @@ +{ + "module_name": "usage_tracker", + "created": "2025-11-13", + "last_updated": "2025-11-13", + "operations_total": 0, + "operations_successful": 0, + "operations_failed": 0 +} \ No newline at end of file diff --git a/src/aipass/api/api_json/usage_tracker_log.json b/src/aipass/api/api_json/usage_tracker_log.json new file mode 100644 index 00000000..34f4255a --- /dev/null +++ b/src/aipass/api/api_json/usage_tracker_log.json @@ -0,0 +1,9 @@ +[ + { + "timestamp": "2026-03-06T19:26:41.965942", + "operation": "usage_stats", + "data": { + "command": "stats" + } + } +] \ No newline at end of file diff --git a/src/aipass/api/apps/api.py b/src/aipass/api/apps/api.py index e1bce259..906585d4 100644 --- a/src/aipass/api/apps/api.py +++ b/src/aipass/api/apps/api.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/api/apps/handlers/__init__.py b/src/aipass/api/apps/handlers/__init__.py index 2b5a05da..f107843b 100644 --- a/src/aipass/api/apps/handlers/__init__.py +++ b/src/aipass/api/apps/handlers/__init__.py @@ -28,7 +28,7 @@ def _extract_branch_name(filepath: str) -> str: """Extract branch name from a file path.""" parts = filepath.split("/") for i, part in enumerate(parts): - if part in ("aipass_core", "MEMORY_BANK", "seed", ".vscode"): + if part in ("MEMORY_BANK", "seed", ".vscode"): if i + 1 < len(parts): return parts[i + 1] if part in ("aipass",) and i + 1 < len(parts) and parts[i + 1] == "apps": diff --git a/src/aipass/api/apps/handlers/auth/env.py b/src/aipass/api/apps/handlers/auth/env.py index 59793d41..4d6fdd15 100644 --- a/src/aipass/api/apps/handlers/auth/env.py +++ b/src/aipass/api/apps/handlers/auth/env.py @@ -1,5 +1,3 @@ -#!/home/aipass/.venv/bin/python3 -# -*- coding: utf-8 -*- # ===================AIPASS==================== # META DATA HEADER @@ -51,7 +49,7 @@ from aipass.cli.apps.modules import console API_ROOT = Path(__file__).resolve().parent.parent.parent.parent DEFAULT_ENV_PATHS = [ API_ROOT / ".env", # /.env - Path.home() / ".env", # ~/.env + Path.cwd() / ".env", # /.env ] @@ -64,9 +62,8 @@ def read_env_file(env_var: str, search_paths: Optional[List[Path]] = None) -> Op Read environment variable from .env files with multi-path search. Searches multiple .env file locations in order: - 1. /home/aipass/aipass_core/api/.env - 2. /home/aipass/aipass_core/.env - 3. /home/aipass/.env + 1. /.env (package-relative) + 2. /.env (current working directory) Args: env_var: Environment variable name to read (e.g., 'OPENROUTER_API_KEY') @@ -118,7 +115,7 @@ def read_env_file_dict(env_path: Path) -> Dict[str, str]: dict: Dictionary of key-value pairs from .env file Example: - >>> env_vars = read_env_file_dict(Path('/home/aipass/aipass_core/api/.env')) + >>> env_vars = read_env_file_dict(Path('api/.env')) >>> print(env_vars.get('OPENROUTER_API_KEY')) """ env_dict = {} @@ -167,7 +164,7 @@ def create_env_template(provider: str = "openrouter", target_path: Optional[Path Example: >>> if create_env_template('openrouter'): - ... print("Template created at /home/aipass/aipass_core/api/.env") + ... print("Template created at /.env") """ # Default to api/.env env_path = target_path or (API_ROOT / ".env") diff --git a/src/aipass/api/apps/handlers/auth/keys.py b/src/aipass/api/apps/handlers/auth/keys.py index b41e2b36..f12c85b7 100644 --- a/src/aipass/api/apps/handlers/auth/keys.py +++ b/src/aipass/api/apps/handlers/auth/keys.py @@ -1,5 +1,3 @@ -#!/home/aipass/.venv/bin/python3 -# -*- coding: utf-8 -*- # ===================AIPASS==================== # META DATA HEADER @@ -130,7 +128,7 @@ def get_key_from_config(provider: str) -> Optional[str]: """ Retrieve API key from config JSON file. - Reads from: /home/aipass/aipass_core/api/api_json/api_connect_config.json + Reads from: /api_json/api_connect_config.json Args: provider: Provider name (e.g., 'openrouter') diff --git a/src/aipass/api/apps/handlers/config/provider.py b/src/aipass/api/apps/handlers/config/provider.py index e2a74db9..51d0ff88 100644 --- a/src/aipass/api/apps/handlers/config/provider.py +++ b/src/aipass/api/apps/handlers/config/provider.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/api/apps/handlers/json/json_handler.py b/src/aipass/api/apps/handlers/json/json_handler.py index 563fc0a1..c5d9ba84 100755 --- a/src/aipass/api/apps/handlers/json/json_handler.py +++ b/src/aipass/api/apps/handlers/json/json_handler.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -25,8 +24,9 @@ import inspect # Infrastructure -# Constants -API_ROOT = Path.home() / "aipass_core" / "api" +# Constants — package-relative paths +# Navigate: json_handler.py -> json/ -> handlers/ -> apps/ -> api/ +API_ROOT = Path(__file__).resolve().parent.parent.parent.parent API_JSON_DIR = API_ROOT / "api_json" JSON_TEMPLATES_DIR = API_ROOT / "apps" / "json_templates" @@ -275,7 +275,7 @@ if __name__ == "__main__": update_data_metrics("api", test_metric="working") console.print() - console.print("[green]Check /home/aipass/aipass_core/api/api_json/ for created files:[/green]") + console.print(f"[green]Check {API_JSON_DIR}/ for created files:[/green]") console.print(" [dim]•[/dim] api_config.json") console.print(" [dim]•[/dim] api_data.json") console.print(" [dim]•[/dim] api_log.json") diff --git a/src/aipass/api/apps/handlers/openrouter/caller.py b/src/aipass/api/apps/handlers/openrouter/caller.py index 3f09302d..d4e9f5fb 100644 --- a/src/aipass/api/apps/handlers/openrouter/caller.py +++ b/src/aipass/api/apps/handlers/openrouter/caller.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python3 # ============================================= # META DATA HEADER diff --git a/src/aipass/api/apps/handlers/openrouter/client.py b/src/aipass/api/apps/handlers/openrouter/client.py index 24a34273..9566e3cf 100644 --- a/src/aipass/api/apps/handlers/openrouter/client.py +++ b/src/aipass/api/apps/handlers/openrouter/client.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/api/apps/handlers/openrouter/models.py b/src/aipass/api/apps/handlers/openrouter/models.py index fe957bd6..1d42487b 100644 --- a/src/aipass/api/apps/handlers/openrouter/models.py +++ b/src/aipass/api/apps/handlers/openrouter/models.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -20,9 +19,7 @@ Business logic for querying and filtering OpenRouter models: - Parse model data and capabilities - Extract model metadata (context, pricing, capabilities) -Extracted from: -- /home/aipass/aipass_core/api/apps/archive.temp/openrouter.py -- /home/aipass/aipass_core/api/.archive/find_free_models.py +Extracted from legacy archive files (openrouter.py, find_free_models.py). """ # AIPASS_ROOT import pattern diff --git a/src/aipass/api/apps/handlers/openrouter/provision.py b/src/aipass/api/apps/handlers/openrouter/provision.py index 6b1eb042..09dc7a9c 100644 --- a/src/aipass/api/apps/handlers/openrouter/provision.py +++ b/src/aipass/api/apps/handlers/openrouter/provision.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/api/apps/handlers/telegram/__init__.py b/src/aipass/api/apps/handlers/telegram/__init__.py index 107a33ad..bd1534d0 100644 --- a/src/aipass/api/apps/handlers/telegram/__init__.py +++ b/src/aipass/api/apps/handlers/telegram/__init__.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/api/apps/handlers/telegram/base_bot.py b/src/aipass/api/apps/handlers/telegram/base_bot.py index 06fefcd4..61b9991d 100644 --- a/src/aipass/api/apps/handlers/telegram/base_bot.py +++ b/src/aipass/api/apps/handlers/telegram/base_bot.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -46,7 +45,7 @@ Usage: bot = BaseBot( bot_id="dev_central", bot_token="123:ABC", - work_dir=Path("/home/aipass/aipass_os/dev_central"), + work_dir=Path.cwd(), bot_name="AIPass Dev Central Bot", allowed_user_ids=[7235222625], ) @@ -65,6 +64,7 @@ import argparse import atexit import json import os +import shutil import signal import subprocess import threading @@ -115,7 +115,16 @@ from aipass.api.apps.handlers.telegram.log_streamer import LogStreamer # MODULE-LEVEL CONSTANTS # ============================================= -PENDING_DIR = Path.home() / ".aipass" / "telegram_pending" +def _aipass_data_dir() -> Path: + """User data directory for AIPass runtime files (config, state, pending).""" + env = os.environ.get("AIPASS_DATA_DIR") + if env: + return Path(env) + return Path(os.environ.get("XDG_DATA_HOME", Path.home() / ".local" / "share")) / "aipass" + +_DATA_DIR = _aipass_data_dir() + +PENDING_DIR = _DATA_DIR / "telegram_pending" PENDING_TTL = 3600 # 1 hour TELEGRAM_CHAR_LIMIT = 4096 RATE_LIMIT_MESSAGES = 5 @@ -123,7 +132,7 @@ RATE_LIMIT_WINDOW = 60 POLL_TIMEOUT = 30 SEND_KEYS_DELAY = 0.5 HEARTBEAT_INTERVAL = 30 # seconds -CLAUDE_BIN = str(Path.home() / ".local" / "bin" / "claude") +CLAUDE_BIN = shutil.which("claude") or "claude" TEMP_DIR = Path("/tmp/telegram_uploads") MAX_FILE_SIZE = 10 * 1024 * 1024 # 10MB @@ -216,10 +225,10 @@ class BaseBot: self.logger = get_direct_logger() # Lock file - self._lock_file = Path.home() / ".aipass" / "telegram_bots" / f".{bot_id}.lock" + self._lock_file = _DATA_DIR / "telegram_bots" / f".{bot_id}.lock" # Offset file - self._offset_file = Path.home() / ".aipass" / "telegram_bots" / f"{bot_id}_offset.json" + self._offset_file = _DATA_DIR / "telegram_bots" / f"{bot_id}_offset.json" # ============================================= # MAIN ENTRY POINT @@ -1475,7 +1484,9 @@ class BaseBot: """ slug = str(self.work_dir).replace("/", "-") # Look for transcript files matching the session pattern - projects_dir = Path.home() / ".claude" / "projects" / slug + # Claude Code stores transcripts under ~/.claude/projects/ + claude_home = Path(os.environ.get("CLAUDE_HOME", Path.home() / ".claude")) + projects_dir = claude_home / "projects" / slug if not projects_dir.exists(): return 0 @@ -1758,11 +1769,11 @@ if __name__ == "__main__": parser.add_argument("--config", help="Path to bot config JSON") args = parser.parse_args() - # Load config from ~/.aipass/telegram_bots/{bot_id}.json or --config path + # Load config from data dir telegram_bots/{bot_id}.json or --config path config_path = ( Path(args.config) if args.config - else Path.home() / ".aipass" / "telegram_bots" / f"{args.bot_id}.json" + else _DATA_DIR / "telegram_bots" / f"{args.bot_id}.json" ) with open(config_path, "r", encoding="utf-8") as f: @@ -1771,7 +1782,7 @@ if __name__ == "__main__": bot = BaseBot( bot_id=args.bot_id, bot_token=config["bot_token"], - work_dir=Path(config.get("work_dir", str(Path.home()))), + work_dir=Path(config.get("work_dir", str(Path.cwd()))), bot_name=config.get("bot_name", "AIPass Bot"), allowed_user_ids=config.get("allowed_user_ids", []), branch_name=config.get("branch_name"), diff --git a/src/aipass/api/apps/handlers/telegram/bot_factory.py b/src/aipass/api/apps/handlers/telegram/bot_factory.py index f5487a2c..9b472fc3 100644 --- a/src/aipass/api/apps/handlers/telegram/bot_factory.py +++ b/src/aipass/api/apps/handlers/telegram/bot_factory.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -38,6 +37,8 @@ from pathlib import Path # Standard library import json +import os +import shutil import subprocess from datetime import datetime, timezone from typing import Optional @@ -57,9 +58,26 @@ from aipass.api.apps.handlers.telegram.bot_registry import ( # ============================================= TELEGRAM_API = "https://api.telegram.org/bot{token}" -BOT_CONFIG_DIR = Path.home() / ".aipass" / "telegram_bots" -BRANCH_REGISTRY = Path.home() / "BRANCH_REGISTRY.json" -SYSTEMD_DIR = Path.home() / ".config" / "systemd" / "user" + +def _aipass_data_dir() -> Path: + """User data directory for AIPass runtime files.""" + env = os.environ.get("AIPASS_DATA_DIR") + if env: + return Path(env) + return Path(os.environ.get("XDG_DATA_HOME", Path.home() / ".local" / "share")) / "aipass" + +def _find_repo_root() -> Path: + """Walk up from this file to find AIPASS_REGISTRY.json (repo root).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + +_DATA_DIR = _aipass_data_dir() +BOT_CONFIG_DIR = _DATA_DIR / "telegram_bots" +BRANCH_REGISTRY = _find_repo_root() / "AIPASS_REGISTRY.json" +SYSTEMD_DIR = Path(os.environ.get("XDG_CONFIG_HOME", Path.home() / ".config")) / "systemd" / "user" # Default commands set on every new bot via BotFather DEFAULT_BOT_COMMANDS = [ @@ -269,7 +287,7 @@ def start_bot_process(bot_id: str) -> bool: True if the process was launched successfully, False otherwise. """ BASE_BOT_PATH = Path(__file__).resolve().parent / "base_bot.py" - PYTHON = str(Path.home() / ".venv" / "bin" / "python3") + PYTHON = shutil.which("python3") or sys.executable try: proc = subprocess.Popen( @@ -366,7 +384,7 @@ def create_bot( BOT_USERNAME = bot_info.get("username", "unknown") # Step 2: Validate branch if provided - RESOLVED_WORK_DIR = str(Path.home()) if work_dir is None else str(work_dir) + RESOLVED_WORK_DIR = str(Path.cwd()) if work_dir is None else str(work_dir) if branch_name: branch_info = validate_branch(branch_name) if not branch_info: @@ -516,7 +534,7 @@ def delete_bot(bot_id: str, kill_tmux: bool = True) -> bool: logger.warning("Failed to remove config file: %s", e) # Step 4: Clean up pending files (both v1 and v2 naming) - PENDING_DIR = Path.home() / ".aipass" / "telegram_pending" + PENDING_DIR = _DATA_DIR / "telegram_pending" BRANCH_NAME = bot.get("branch_name", bot_id) # v2 naming: bot-{bot_id}.json diff --git a/src/aipass/api/apps/handlers/telegram/bot_operations.py b/src/aipass/api/apps/handlers/telegram/bot_operations.py index 7358efc4..dbc39a18 100644 --- a/src/aipass/api/apps/handlers/telegram/bot_operations.py +++ b/src/aipass/api/apps/handlers/telegram/bot_operations.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -71,7 +70,7 @@ def start_bot(bot_id: str) -> int | None: if not bot_token: return None - work_dir = Path(config.get("work_dir", str(Path.home()))) + work_dir = Path(config.get("work_dir", str(Path.cwd()))) bot_name = config.get("bot_name", f"AIPass {bot_id} Bot") allowed_user_ids = config.get("allowed_user_ids", []) branch_name = config.get("branch_name") diff --git a/src/aipass/api/apps/handlers/telegram/bot_registry.py b/src/aipass/api/apps/handlers/telegram/bot_registry.py index f2a73774..6ba9532a 100644 --- a/src/aipass/api/apps/handlers/telegram/bot_registry.py +++ b/src/aipass/api/apps/handlers/telegram/bot_registry.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -36,6 +35,7 @@ from pathlib import Path # Standard library import fcntl import json +import os from datetime import datetime, timezone from typing import Optional @@ -46,7 +46,14 @@ from aipass.prax.apps.modules.logger import system_logger as logger # CONSTANTS # ============================================= -REGISTRY_DIR = Path.home() / ".aipass" / "telegram_bots" +def _aipass_data_dir() -> Path: + """User data directory for AIPass runtime files.""" + env = os.environ.get("AIPASS_DATA_DIR") + if env: + return Path(env) + return Path(os.environ.get("XDG_DATA_HOME", Path.home() / ".local" / "share")) / "aipass" + +REGISTRY_DIR = _aipass_data_dir() / "telegram_bots" REGISTRY_FILE = REGISTRY_DIR / "_registry.json" # ============================================= diff --git a/src/aipass/api/apps/handlers/telegram/botfather_client.py b/src/aipass/api/apps/handlers/telegram/botfather_client.py index 166b93a8..b11b7dee 100644 --- a/src/aipass/api/apps/handlers/telegram/botfather_client.py +++ b/src/aipass/api/apps/handlers/telegram/botfather_client.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -44,6 +43,7 @@ from pathlib import Path # Standard library import asyncio import json +import os import re import time from typing import Any, Optional @@ -64,7 +64,14 @@ except ImportError: # CONSTANTS # ============================================= -BOT_CONFIG_DIR = Path.home() / ".aipass" / "telegram_bots" +def _aipass_data_dir() -> Path: + """User data directory for AIPass runtime files.""" + env = os.environ.get("AIPASS_DATA_DIR") + if env: + return Path(env) + return Path(os.environ.get("XDG_DATA_HOME", Path.home() / ".local" / "share")) / "aipass" + +BOT_CONFIG_DIR = _aipass_data_dir() / "telegram_bots" TELETHON_CONFIG_PATH = BOT_CONFIG_DIR / ".telethon_config.json" SESSION_PATH = BOT_CONFIG_DIR / ".telethon" # Telethon appends .session automatically diff --git a/src/aipass/api/apps/handlers/telegram/branch_plugin.py b/src/aipass/api/apps/handlers/telegram/branch_plugin.py index b67fb613..6758c2b8 100644 --- a/src/aipass/api/apps/handlers/telegram/branch_plugin.py +++ b/src/aipass/api/apps/handlers/telegram/branch_plugin.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -30,7 +29,7 @@ Usage: branch_name="dev_central", bot_id="dev_central", bot_token="123:ABC", - work_dir=Path("/home/aipass/aipass_os/dev_central"), + work_dir=Path.cwd(), bot_name="AIPass Dev Central Bot", allowed_user_ids=[7235222625], ) @@ -38,6 +37,7 @@ Usage: """ # Infrastructure +import os import sys from pathlib import Path @@ -130,11 +130,15 @@ if __name__ == "__main__": parser.add_argument("--config", help="Path to bot config JSON") args = parser.parse_args() - # Load config from ~/.aipass/telegram_bots/{bot_id}.json or --config path + # Load config from data dir telegram_bots/{bot_id}.json or --config path + _env_data = os.environ.get("AIPASS_DATA_DIR") + _data_dir = Path(_env_data) if _env_data else ( + Path(os.environ.get("XDG_DATA_HOME", Path.home() / ".local" / "share")) / "aipass" + ) config_path = ( Path(args.config) if args.config - else Path.home() / ".aipass" / "telegram_bots" / f"{args.bot_id}.json" + else _data_dir / "telegram_bots" / f"{args.bot_id}.json" ) with open(config_path, "r", encoding="utf-8") as f: @@ -157,7 +161,7 @@ if __name__ == "__main__": bot = BaseBot( bot_id=args.bot_id, bot_token=config["bot_token"], - work_dir=Path(config.get("work_dir", str(Path.home()))), + work_dir=Path(config.get("work_dir", str(Path.cwd()))), bot_name=config.get("bot_name", "AIPass Bot"), allowed_user_ids=config.get("allowed_user_ids", []), shared_session=shared_session, diff --git a/src/aipass/api/apps/handlers/telegram/config.py b/src/aipass/api/apps/handlers/telegram/config.py index bfbd0ccf..4544fea6 100644 --- a/src/aipass/api/apps/handlers/telegram/config.py +++ b/src/aipass/api/apps/handlers/telegram/config.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -29,6 +28,7 @@ Manages Telegram bot configuration: """ # Infrastructure +import os import sys from pathlib import Path @@ -40,8 +40,16 @@ from typing import Optional, List # CONSTANTS # ============================================= -CONFIG_PATH = Path.home() / ".aipass" / "telegram_config.json" -BOT_CONFIG_DIR = Path.home() / ".aipass" / "telegram_bots" +def _aipass_data_dir() -> Path: + """User data directory for AIPass runtime files.""" + env = os.environ.get("AIPASS_DATA_DIR") + if env: + return Path(env) + return Path(os.environ.get("XDG_DATA_HOME", Path.home() / ".local" / "share")) / "aipass" + +_DATA_DIR = _aipass_data_dir() +CONFIG_PATH = _DATA_DIR / "telegram_config.json" +BOT_CONFIG_DIR = _DATA_DIR / "telegram_bots" REQUIRED_BOT_FIELDS = ("bot_id", "bot_token") @@ -165,7 +173,7 @@ def load_bot_config(bot_id: str) -> dict | None: "bot_token": "123:ABC...", "bot_name": "AIPass Dev Central Bot", "branch_name": "dev_central", // null for base bot - "work_dir": "/home/aipass/aipass_os/dev_central", + "work_dir": "/path/to/branch/work_dir", "allowed_user_ids": [7235222625] } diff --git a/src/aipass/api/apps/handlers/telegram/file_handler.py b/src/aipass/api/apps/handlers/telegram/file_handler.py index 6c05423f..4ce003a1 100644 --- a/src/aipass/api/apps/handlers/telegram/file_handler.py +++ b/src/aipass/api/apps/handlers/telegram/file_handler.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/api/apps/handlers/telegram/log_streamer.py b/src/aipass/api/apps/handlers/telegram/log_streamer.py index 47f88a60..abf1f365 100644 --- a/src/aipass/api/apps/handlers/telegram/log_streamer.py +++ b/src/aipass/api/apps/handlers/telegram/log_streamer.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -51,7 +50,15 @@ from aipass.prax.apps.modules.logger import get_direct_logger # CONSTANTS # ============================================= -SYSTEM_LOGS_DIR = Path("/home/aipass/system_logs") +def _find_repo_root() -> Path: + """Walk up from this file to find AIPASS_REGISTRY.json (repo root).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + +SYSTEM_LOGS_DIR = _find_repo_root() / "logs" BATCH_INTERVAL = 5.0 TELEGRAM_MAX_LENGTH = 4000 diff --git a/src/aipass/api/apps/handlers/telegram/notifier.py b/src/aipass/api/apps/handlers/telegram/notifier.py index a4219d9b..a827a8ee 100644 --- a/src/aipass/api/apps/handlers/telegram/notifier.py +++ b/src/aipass/api/apps/handlers/telegram/notifier.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -28,6 +27,7 @@ Reads bot token and chat_id from ~/.aipass/scheduler_config.json. """ # Infrastructure +import os import sys from pathlib import Path @@ -40,7 +40,14 @@ from urllib.error import URLError # CONSTANTS # ============================================= -CONFIG_PATH = Path.home() / ".aipass" / "scheduler_config.json" +def _aipass_data_dir() -> Path: + """User data directory for AIPass runtime files.""" + env = os.environ.get("AIPASS_DATA_DIR") + if env: + return Path(env) + return Path(os.environ.get("XDG_DATA_HOME", Path.home() / ".local" / "share")) / "aipass" + +CONFIG_PATH = _aipass_data_dir() / "scheduler_config.json" # ============================================= # PUBLIC API diff --git a/src/aipass/api/apps/handlers/telegram/output_parser.py(disabled) b/src/aipass/api/apps/handlers/telegram/output_parser.py(disabled) index 271349d9..7891d50d 100644 --- a/src/aipass/api/apps/handlers/telegram/output_parser.py(disabled) +++ b/src/aipass/api/apps/handlers/telegram/output_parser.py(disabled) @@ -1,4 +1,4 @@ -#!/home/aipass/.venv/bin/python3 +#!/usr/bin/env python3 # ===================AIPASS==================== # META DATA HEADER @@ -34,9 +34,7 @@ from dataclasses import dataclass from pathlib import Path from typing import List, Optional -# Infrastructure -AIPASS_ROOT = Path.home() / "aipass_core" -sys.path.insert(0, str(AIPASS_ROOT)) +# Infrastructure — disabled file, no sys.path manipulation needed logger = logging.getLogger("telegram_output_parser") diff --git a/src/aipass/api/apps/handlers/telegram/response_router.py b/src/aipass/api/apps/handlers/telegram/response_router.py index e626f2e0..2267626e 100644 --- a/src/aipass/api/apps/handlers/telegram/response_router.py +++ b/src/aipass/api/apps/handlers/telegram/response_router.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -21,9 +20,8 @@ CWD-Safe Response Routing for Multi-Bot Architecture Fixes the CWD mismatch bug in the Stop hook. When Claude fires the Stop hook, the working directory may be a subdirectory of the branch root (e.g., -/home/aipass/aipass_os/dev_central/git_repo/ instead of -/home/aipass/aipass_os/dev_central/). The old logic used Path.cwd().name -which fails in subdirectories. +/git_repo/ instead of /). The old logic used +Path.cwd().name which fails in subdirectories. New logic uses cwd.relative_to(work_dir) which succeeds if CWD is ANYWHERE in the bot's directory tree. @@ -52,7 +50,15 @@ from aipass.prax.apps.modules.logger import system_logger as logger # CONSTANTS # ============================================= -PENDING_DIR = Path.home() / ".aipass" / "telegram_pending" +def _aipass_data_dir() -> Path: + """User data directory for AIPass runtime files.""" + env = os.environ.get("AIPASS_DATA_DIR") + if env: + return Path(env) + return Path(os.environ.get("XDG_DATA_HOME", Path.home() / ".local" / "share")) / "aipass" + +_DATA_DIR = _aipass_data_dir() +PENDING_DIR = _DATA_DIR / "telegram_pending" PENDING_TTL = 3600 # 1 hour @@ -225,7 +231,7 @@ def find_pending_bot( try: cwd = Path.cwd() except OSError: - cwd = Path.home() + cwd = Path.cwd() if env_bot_id is None: env_bot_id = os.environ.get("AIPASS_BOT_ID") diff --git a/src/aipass/api/apps/handlers/telegram/spawner.py(disabled) b/src/aipass/api/apps/handlers/telegram/spawner.py(disabled) index 724375b1..b2e958f4 100644 --- a/src/aipass/api/apps/handlers/telegram/spawner.py(disabled) +++ b/src/aipass/api/apps/handlers/telegram/spawner.py(disabled) @@ -1,4 +1,4 @@ -#!/home/aipass/.venv/bin/python3 +#!/usr/bin/env python3 # ===================AIPASS==================== # META DATA HEADER @@ -28,7 +28,7 @@ Two modes of operation: 2. Capture mode: Run Claude directly and capture stdout for response Supports branch targeting: messages starting with @branch_name spawn Claude -in that branch's directory. Default: /home/aipass/aipass_os/dev_central. +in that branch's directory. """ import sys @@ -42,20 +42,19 @@ import uuid from pathlib import Path from typing import Tuple, Optional, List -# Infrastructure -AIPASS_ROOT = Path.home() / "aipass_core" -sys.path.insert(0, str(AIPASS_ROOT)) +# Infrastructure — disabled file, kept for reference only import logging logger = logging.getLogger("telegram_spawner") -from api.apps.handlers.telegram.output_parser import OutputParser, ParsedResult -from api.apps.handlers.telegram.session_store import get_session, save_session +# NOTE: These imports reference old non-aipass namespace and won't work. +# from api.apps.handlers.telegram.output_parser import OutputParser, ParsedResult +# from api.apps.handlers.telegram.session_store import get_session, save_session -# Constants -DEFAULT_SESSION_PATH = Path.home() / "aipass_os" / "dev_central" -BRANCH_REGISTRY_PATH = Path.home() / "BRANCH_REGISTRY.json" -CLAUDE_BIN = str(Path.home() / ".local" / "bin" / "claude") +# Constants — package-relative +DEFAULT_SESSION_PATH = Path.cwd() +BRANCH_REGISTRY_PATH = Path.cwd() / "AIPASS_REGISTRY.json" +CLAUDE_BIN = shutil.which("claude") or "claude" TMUX_SESSION_NAME = "telegram-claude" TELEGRAM_CHAR_LIMIT = 4096 DEFAULT_TIMEOUT = 120 # seconds diff --git a/src/aipass/api/apps/handlers/telegram/telegram_standards.py b/src/aipass/api/apps/handlers/telegram/telegram_standards.py index ebcb96ee..14d1b58f 100644 --- a/src/aipass/api/apps/handlers/telegram/telegram_standards.py +++ b/src/aipass/api/apps/handlers/telegram/telegram_standards.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/api/apps/handlers/telegram/tmux_manager.py b/src/aipass/api/apps/handlers/telegram/tmux_manager.py index 47bc8002..8e930a8c 100644 --- a/src/aipass/api/apps/handlers/telegram/tmux_manager.py +++ b/src/aipass/api/apps/handlers/telegram/tmux_manager.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -44,7 +43,7 @@ from typing import List, Optional # Constants SESSION_PREFIX = "telegram-" DEFAULT_BRANCH = "dev_central" -CLAUDE_BIN = str(Path.home() / ".local" / "bin" / "claude") +CLAUDE_BIN = shutil.which("claude") or "claude" SEND_KEYS_DELAY = 0.5 # seconds between text injection and Enter diff --git a/src/aipass/api/apps/handlers/telegram_service/service.py b/src/aipass/api/apps/handlers/telegram_service/service.py index 46b2653f..9e4de694 100644 --- a/src/aipass/api/apps/handlers/telegram_service/service.py +++ b/src/aipass/api/apps/handlers/telegram_service/service.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -18,12 +17,21 @@ Telegram Service Handler Low-level systemd operations for telegram-bridge service. """ +import os import subprocess from pathlib import Path from typing import Tuple +def _find_repo_root() -> Path: + """Walk up from this file to find AIPASS_REGISTRY.json (repo root).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + SERVICE_NAME = "telegram-bridge" -LOG_FILE = Path.home() / "system_logs" / "telegram_bridge.log" +LOG_FILE = _find_repo_root() / "logs" / "telegram_bridge.log" def start_service() -> Tuple[bool, str]: diff --git a/src/aipass/api/apps/handlers/usage/aggregation.py b/src/aipass/api/apps/handlers/usage/aggregation.py index 1d2b04a3..d26ffe8d 100644 --- a/src/aipass/api/apps/handlers/usage/aggregation.py +++ b/src/aipass/api/apps/handlers/usage/aggregation.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -21,7 +20,7 @@ Business logic for aggregating usage statistics: - Cost, token, and latency aggregation - Model usage tracking and breakdown -Extracted from: /home/aipass/aipass_core/api/apps/archive.temp/api_usage.py +Extracted from legacy archive (api_usage.py). Functions: get_caller_usage(), get_session_summary(), get_daily_usage() """ diff --git a/src/aipass/api/apps/handlers/usage/cleanup.py b/src/aipass/api/apps/handlers/usage/cleanup.py index 8cd72bc2..20b86231 100644 --- a/src/aipass/api/apps/handlers/usage/cleanup.py +++ b/src/aipass/api/apps/handlers/usage/cleanup.py @@ -1,5 +1,3 @@ -#!/home/aipass/.venv/bin/python3 -# -*- coding: utf-8 -*- # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/api/apps/handlers/usage/tracking.py b/src/aipass/api/apps/handlers/usage/tracking.py index 5fa69adb..8f8a37cb 100644 --- a/src/aipass/api/apps/handlers/usage/tracking.py +++ b/src/aipass/api/apps/handlers/usage/tracking.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -20,7 +19,7 @@ Business logic for tracking API usage from OpenRouter: - Store generation tracking data with newest-first ordering - Handle HTTP requests with proper error handling -Extracted from: /home/aipass/aipass_core/api/apps/archive.temp/api_usage.py +Extracted from legacy archive (api_usage.py). Functions: track_usage(), _get_generation_metrics(), _store_usage_data() """ diff --git a/src/aipass/api/apps/modules/api_key.py b/src/aipass/api/apps/modules/api_key.py index 27c28ff3..9643185f 100644 --- a/src/aipass/api/apps/modules/api_key.py +++ b/src/aipass/api/apps/modules/api_key.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/api/apps/modules/openrouter_client.py b/src/aipass/api/apps/modules/openrouter_client.py index fa8c079e..ba122654 100644 --- a/src/aipass/api/apps/modules/openrouter_client.py +++ b/src/aipass/api/apps/modules/openrouter_client.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/api/apps/modules/telegram_bot.py b/src/aipass/api/apps/modules/telegram_bot.py index 080cf562..d902448d 100644 --- a/src/aipass/api/apps/modules/telegram_bot.py +++ b/src/aipass/api/apps/modules/telegram_bot.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/api/apps/modules/telegram_service.py b/src/aipass/api/apps/modules/telegram_service.py index fb84ea30..c8d9e730 100644 --- a/src/aipass/api/apps/modules/telegram_service.py +++ b/src/aipass/api/apps/modules/telegram_service.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/api/apps/modules/usage_tracker.py b/src/aipass/api/apps/modules/usage_tracker.py index 48d7a1ae..5fd46403 100644 --- a/src/aipass/api/apps/modules/usage_tracker.py +++ b/src/aipass/api/apps/modules/usage_tracker.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -239,7 +238,7 @@ def cleanup_data(args: List[str]): # Fire trigger event try: - from trigger.apps.modules.core import trigger + from aipass.trigger.apps.modules.core import trigger trigger.fire('usage_data_cleaned', days=days, data_path=str(data_path)) except ImportError: pass # Silent fallback diff --git a/src/aipass/api/tests/conftest.py b/src/aipass/api/tests/conftest.py index a87088fd..3cccc54b 100644 --- a/src/aipass/api/tests/conftest.py +++ b/src/aipass/api/tests/conftest.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/cli/apps/__init__.py b/src/aipass/cli/apps/__init__.py index 5f6b8dc0..1d09dbea 100644 --- a/src/aipass/cli/apps/__init__.py +++ b/src/aipass/cli/apps/__init__.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/cli/apps/cli.py b/src/aipass/cli/apps/cli.py index 2718b0ad..550e6425 100755 --- a/src/aipass/cli/apps/cli.py +++ b/src/aipass/cli/apps/cli.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -33,6 +32,7 @@ ARCHITECTURE: import sys import importlib +from pathlib import Path from typing import List # Prax logger @@ -305,9 +305,10 @@ def print_help(): # ============================================================================= CONSOLE.print("[bold cyan]FULL DOCUMENTATION:[/bold cyan]") CONSOLE.print() - CONSOLE.print(" [yellow]Source code:[/yellow] [dim]/home/aipass/aipass_core/cli/apps/[/dim]") - CONSOLE.print(" [yellow]Public API:[/yellow] [dim]/home/aipass/aipass_core/cli/apps/modules/[/dim]") - CONSOLE.print(" [yellow]Implementation:[/yellow] [dim]/home/aipass/aipass_core/cli/apps/handlers/[/dim]") + _cli_root = Path(__file__).resolve().parents[1] # cli.py -> apps -> cli + CONSOLE.print(f" [yellow]Source code:[/yellow] [dim]{_cli_root / 'apps'}[/dim]") + CONSOLE.print(f" [yellow]Public API:[/yellow] [dim]{_cli_root / 'apps' / 'modules'}[/dim]") + CONSOLE.print(f" [yellow]Implementation:[/yellow] [dim]{_cli_root / 'apps' / 'handlers'}[/dim]") CONSOLE.print() CONSOLE.print("─" * 70) CONSOLE.print() diff --git a/src/aipass/cli/apps/extensions/__init__.py b/src/aipass/cli/apps/extensions/__init__.py index 6839ee7d..d7f3ea09 100644 --- a/src/aipass/cli/apps/extensions/__init__.py +++ b/src/aipass/cli/apps/extensions/__init__.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/cli/apps/handlers/__init__.py b/src/aipass/cli/apps/handlers/__init__.py index 99270689..5693db54 100755 --- a/src/aipass/cli/apps/handlers/__init__.py +++ b/src/aipass/cli/apps/handlers/__init__.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -67,7 +66,7 @@ def _extract_branch_name(filepath: str) -> str: """Extract branch name from a file path.""" parts = filepath.split("/") for i, part in enumerate(parts): - if part in ("aipass_core", "MEMORY_BANK", "Nexus"): + if part == "aipass": if i + 1 < len(parts): return parts[i + 1] return "unknown" diff --git a/src/aipass/cli/apps/handlers/json/json_handler.py b/src/aipass/cli/apps/handlers/json/json_handler.py index 1480e30c..3df5eee2 100755 --- a/src/aipass/cli/apps/handlers/json/json_handler.py +++ b/src/aipass/cli/apps/handlers/json/json_handler.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -23,8 +22,8 @@ from typing import Dict, List, Any, Optional import sys import inspect -# Constants -CLI_ROOT = Path.home() / "aipass_core" / "cli" +# Constants — package-relative paths (portable across any machine) +CLI_ROOT = Path(__file__).resolve().parents[3] # json_handler.py -> json -> handlers -> apps -> cli CLI_JSON_DIR = CLI_ROOT / "cli_json" JSON_TEMPLATES_DIR = CLI_ROOT / "apps" / "json_templates" @@ -256,7 +255,7 @@ if __name__ == "__main__": update_data_metrics("cli", test_metric="working") console.print() - console.print("[green]Check /home/aipass/aipass_core/cli/cli_json/ for created files:[/green]") + console.print(f"[green]Check {CLI_JSON_DIR}/ for created files:[/green]") console.print(" [dim]•[/dim] cli_config.json") console.print(" [dim]•[/dim] cli_data.json") console.print(" [dim]•[/dim] cli_log.json") diff --git a/src/aipass/cli/apps/json_templates/__init__.py b/src/aipass/cli/apps/json_templates/__init__.py index ae62b033..86ae9fd4 100644 --- a/src/aipass/cli/apps/json_templates/__init__.py +++ b/src/aipass/cli/apps/json_templates/__init__.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/cli/apps/modules/display.py b/src/aipass/cli/apps/modules/display.py index f5f20cbf..68797dd6 100755 --- a/src/aipass/cli/apps/modules/display.py +++ b/src/aipass/cli/apps/modules/display.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -208,9 +207,11 @@ def print_help(): CONSOLE.print("[bold cyan]REFERENCE:[/bold cyan]") CONSOLE.print() # RICH FORMATTING TIP: Use [yellow] for labels, [dim] for paths - CONSOLE.print(" [yellow]Module:[/yellow] [dim]/home/aipass/aipass_core/cli/apps/modules/display.py[/dim]") - CONSOLE.print(" [yellow]Handlers:[/yellow] [dim]/home/aipass/aipass_core/cli/apps/handlers/display/[/dim]") - CONSOLE.print(" [yellow]Standards:[/yellow] [dim]/home/aipass/standards/CODE_STANDARDS/cli.md[/dim]") + _display_path = Path(__file__).resolve() + _cli_root = _display_path.parents[2] # display.py -> modules -> apps -> cli + CONSOLE.print(f" [yellow]Module:[/yellow] [dim]{_display_path}[/dim]") + CONSOLE.print(f" [yellow]Handlers:[/yellow] [dim]{_cli_root / 'apps' / 'handlers' / 'display'}[/dim]") + CONSOLE.print(f" [yellow]Standards:[/yellow] [dim]See CODE_STANDARDS/cli.md[/dim]") CONSOLE.print() CONSOLE.print("─" * 70) CONSOLE.print() diff --git a/src/aipass/cli/apps/modules/templates.py b/src/aipass/cli/apps/modules/templates.py index b77a90f7..bf1af00d 100755 --- a/src/aipass/cli/apps/modules/templates.py +++ b/src/aipass/cli/apps/modules/templates.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -107,7 +106,7 @@ def print_help(): CONSOLE.print(" [dim]from aipass.cli.apps.modules.templates import operation_start, operation_complete[/dim]") CONSOLE.print() CONSOLE.print(" [dim]# Start operation[/dim]") - CONSOLE.print(" [dim]operation_start('Creating files', target='/home/aipass/my_branch')[/dim]") + CONSOLE.print(" [dim]operation_start('Creating files', target='/path/to/my_branch')[/dim]") CONSOLE.print() CONSOLE.print(" [dim]# ... do work ...[/dim]") CONSOLE.print() @@ -116,7 +115,7 @@ def print_help(): CONSOLE.print() CONSOLE.print("[bold cyan]Reference:[/bold cyan]") - CONSOLE.print(" [dim]/home/aipass/standards/CODE_STANDARDS/cli.md[/dim]") + CONSOLE.print(" [dim]See CODE_STANDARDS/cli.md[/dim]") CONSOLE.print() CONSOLE.print("[bold]Commands: templates, demo, --help[/bold]") @@ -154,11 +153,11 @@ def run_demo(): CONSOLE.print() # Demo operation start - operation_start("Creating new branch", target="/home/aipass/my_branch", type="module") + operation_start("Creating new branch", target="/path/to/my_branch", type="module") # Simulate some work CONSOLE.print("✅ [green]Directory created[/green]") - CONSOLE.print(" [dim]/home/aipass/my_branch[/dim]") + CONSOLE.print(" [dim]/path/to/my_branch[/dim]") CONSOLE.print() CONSOLE.print("✅ [green]Files copied[/green]") diff --git a/src/aipass/cli/apps/plugins/__init__.py b/src/aipass/cli/apps/plugins/__init__.py index b9f11e6e..27c9c6cd 100644 --- a/src/aipass/cli/apps/plugins/__init__.py +++ b/src/aipass/cli/apps/plugins/__init__.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/cli/tests/conftest.py b/src/aipass/cli/tests/conftest.py index a87088fd..3cccc54b 100644 --- a/src/aipass/cli/tests/conftest.py +++ b/src/aipass/cli/tests/conftest.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/devpulse/apps/branch.py b/src/aipass/devpulse/apps/devpulse.py similarity index 97% rename from src/aipass/devpulse/apps/branch.py rename to src/aipass/devpulse/apps/devpulse.py index 7d6debc9..91ab0ecc 100644 --- a/src/aipass/devpulse/apps/branch.py +++ b/src/aipass/devpulse/apps/devpulse.py @@ -32,7 +32,7 @@ def discover_modules() -> List[Any]: if file_path.name.startswith("_"): continue - module_name = f"apps.modules.{file_path.stem}" + module_name = f"aipass.devpulse.apps.modules.{file_path.stem}" try: module = importlib.import_module(module_name) diff --git a/src/aipass/devpulse/docs/FPLAN-001_path_rewire_portability_2026-03-06.md b/src/aipass/devpulse/docs/FPLAN-001_path_rewire_portability_2026-03-06.md new file mode 100644 index 00000000..5d224e43 --- /dev/null +++ b/src/aipass/devpulse/docs/FPLAN-001_path_rewire_portability_2026-03-06.md @@ -0,0 +1,194 @@ +# FPLAN-001 - AIPass Path Rewire & Portability Fix (MASTER PLAN) + +**Created**: 2026-03-06 +**Branch**: src/aipass/devpulse +**Status**: Phase 5 (Final Verification) +**Type**: Master Plan (Multi-Phase) +**Reference**: DPLAN-047 (Path.home() Purge) + +--- + +## Project Overview + +### Goal +All 10 AIPass modules import cleanly on ANY system. Zero filesystem assumptions. Code runs after `pip install -e .` on Mac, Linux, CI runners, Docker — anywhere. + +### CRITICAL: This is a Public Pip Package +AIPass is a PUBLIC pip package installable on ANY machine. There is NO `/home/aipass`. There is NO `aipass_core` directory. There is NO `.venv` at a known location. None of that exists outside Dev-Pass (the private source repo). + +**Dev-Pass vs AIPass confusion is the #1 risk.** Code was ported from Dev-Pass where `/home/aipass` and `aipass_core` are real paths. Here, they are ghosts that crash on import. + +### Only Valid Path Patterns +```python +# 1. Package-relative (where the code lives) +Path(__file__).resolve().parents[N] + +# 2. Walk-up to repo root (finds AIPASS_REGISTRY.json) +def _find_repo_root() -> Path: + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + +# 3. User's working directory +Path.cwd() +``` + +**Everything else is Dev-Pass baggage and MUST be removed or rewired.** + +### Seedgo Standards Adjustment +Seedgo standards were built for Dev-Pass. Standards that don't align with public pip package reality MUST be adjusted: +- Shebang requirements: REMOVED (irrelevant for pip packages) +- `/home/aipass` reference paths in standards content: must be updated +- Any standard assuming filesystem structure beyond the package itself + +### Reference Documentation +- `DPLAN-047_path_home_purge_portability_2026-03-06.md` (repo root) +- `docs/sub_agent_drops/path_home_audit.md` (full audit from session 1) +- `spawn/templates/agent.template/` (reference for correct patterns) + +### Success Criteria +1. `pip install -e .` clean +2. All module top-level imports work (`from aipass.{module} import ...`) +3. `drone systems` shows 10 branches +4. `drone @seedgo verify` passes +5. `drone @seedgo audit aipass` runs without import crashes +6. Zero `Path.home()` or `/home/aipass` in functional code (comments/docstrings updated too) +7. Zero `aipass_core` references in functional code + +--- + +## What We're Cleaning Up + +This is a cleanup of Dev-Pass baggage. The code was ported from a private system that assumes `/home/aipass/aipass_core/` exists. We're making it universal. + +### Fix Categories +1. **FUNCTIONAL** — `Path.home()`, `Path("/home/aipass/...")`, `aipass_core` in actual code logic → MUST fix or code crashes +2. **COMMENTS/DOCSTRINGS** — References to `/home/aipass` in documentation strings → Update to reflect package-relative reality +3. **STRING COMPARISONS** — Code checking for `aipass_core` in path parts → Adapt to new structure (`src/aipass/`) + +### Fix Pattern + +```python +# WRONG — Dev-Pass patterns (CRASH on any other system) +AIPASS_ROOT = Path.home() / "aipass_core" +ECOSYSTEM_ROOT = Path("/home/aipass") +SYSTEM_LOGS_DIR = Path("/home/aipass/system_logs") + +# RIGHT — Package-relative +MODULE_ROOT = Path(__file__).resolve().parents[N] # N = depth to module root + +# RIGHT — Walk-up finder (proven in drone/seedgo) +def _find_repo_root() -> Path: + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + +# RIGHT — Logs go in package-relative location +LOGS_DIR = Path(__file__).resolve().parents[3] / "logs" +``` + +--- + +## Phase Definitions + +### Phase 1: Safe Modules (drone, cli, spawn, devpulse) — COMPLETE +**Goal:** Fix LOW severity modules +**Result:** drone (2 files), cli (12 files), spawn (4 files) — all verified clean +**Remaining:** drone/config.py has 1 Path.home() for registry (quick fix), cli/__init__.py has 1 string comparison (cosmetic) + +### Phase 2: Prax — COMPLETE +**Goal:** `from aipass.prax import logger` works AND deeper handler imports don't crash +**Scope:** ~47 hits across functional code, comments, and string comparisons. Key files: introspection.py (14), branch_detector.py (8), monitor_module.py (6), setup.py (5), log_watcher.py (4) +**Result:** 16 files functional fixes + 17 files comments/docstrings updated. All imports verified. +**Critical:** Unblocks all other modules since they import prax + +### Phase 3: Trigger + Flow — COMPLETE +**Goal:** Fix CRITICAL import-time crashes + all Dev-Pass path references +**Scope:** trigger (~50 hits), flow (~70 hits). CRITICAL: plan_file.py ECOSYSTEM_ROOT, registry_monitor.py ECOSYSTEM_ROOT +**Result:** Trigger 23 files fixed, flow 37 files fixed. All CRITICAL crashes resolved. +**Parallel:** Yes, 2 agents + +### Phase 4: AI Mail + API — COMPLETE +**Goal:** Fix the heaviest modules +**Scope:** ai_mail (~80 hits), api (~70 hits). CRITICAL: ai_mail/registry/read.py, api/log_streamer.py +**Result:** ai_mail 37 files fixed, api 35 files fixed. All CRITICAL crashes resolved. +**Parallel:** Yes, 2 agents + +### Phase 5: Seedgo Standards + Verification — IN PROGRESS +**Goal:** Fix seedgo's own Dev-Pass references + full system test +**Scope:** ~60 hits in seedgo standards content (reference strings pointing to /home/aipass/standards/). Remove shebang standard. Update all reference paths. Run full import + drone verification. +**Critical:** Seedgo standards must reflect the public pip package reality +**Progress:** +- Seedgo standards: 30 files updated (Dev-Pass reference paths) +- Shebang standard: CREATED (new SHEBANG check that fails files with shebangs) +- Shebangs stripped: 205 files cleaned codebase-wide +- Meta docs: aligned to match checker format +- 4 bare import violations: FIXED +- Full verification: All 10 modules import clean, `drone systems` works +- Remaining: Running `seedgo audit` for final violations + +--- + +## Phase Tracking + +### Phase 1: Safe Modules +- **Status:** COMPLETE +- **Agents:** 4 (drone, cli, spawn, devpulse) +- **Result:** All verified clean. Minor residual hits (drone config.py, cli __init__.py) + +### Phase 2: Prax +- **Status:** COMPLETE +- **Agents:** 1 +- **Result:** 16 files functional fixes, 17 files comments/docstrings. All imports verified. + +### Phase 3: Trigger + Flow +- **Status:** COMPLETE +- **Agents:** 2 +- **Result:** Trigger 23 files, flow 37 files. All CRITICAL import crashes fixed. + +### Phase 4: AI Mail + API +- **Status:** COMPLETE +- **Agents:** 2 +- **Result:** ai_mail 37 files, api 35 files. All CRITICAL import crashes fixed. + +### Phase 5: Seedgo Standards + Verification +- **Status:** IN PROGRESS +- **Agents:** 2 (1 for seedgo cleanup, 1 for final verification) +- **Progress:** 30 seedgo files updated, shebang standard created, 205 shebangs stripped, 4 bare imports fixed. All 10 modules import clean. Remaining: final seedgo audit pass. + +--- + +## Issues Log + +| Phase | Issue | Severity | Attempted | Status | +|-------|-------|----------|-----------|--------| +| 2 | Prax agent lost during session compaction | LOW | Retry deployed | RESOLVED | +| 3 | trigger/plan_file.py ECOSYSTEM_ROOT crash | CRITICAL | Phase 3 | RESOLVED | +| 3 | flow/registry_monitor.py ECOSYSTEM_ROOT crash | CRITICAL | Phase 3 | RESOLVED | +| 4 | ai_mail/registry/read.py import crash | CRITICAL | Phase 4 | RESOLVED | +| 4 | api/log_streamer.py import crash | CRITICAL | Phase 4 | RESOLVED | +| 5 | 4 bare import violations (missing aipass. prefix) | HIGH | Phase 5 | RESOLVED | +| 5 | 205 files with shebangs (irrelevant for pip pkg) | MEDIUM | Phase 5 | RESOLVED | +| 5 | Seedgo standards referencing Dev-Pass paths | HIGH | Phase 5 | RESOLVED | +| 5 | Final seedgo audit for remaining violations | MEDIUM | In progress | OPEN | + +--- + +## Notes + +- **PUBLIC PIP PACKAGE** — This is the core principle. Zero filesystem assumptions. Works on any machine. +- **Dev-Pass confusion is the #1 risk** — All code was ported from a system where /home/aipass exists. Be vigilant. +- Seedgo standards built for Dev-Pass MUST be adjusted: shebang standard removed, reference paths updated +- Shebangs are IRRELEVANT for pip packages — don't waste time on them, focus on functional path violations +- Some modules reference Dev-Pass infrastructure (AI_CENTRAL, MEMORY_BANK, telegram) — guard or remove +- 2-attempt rule: if a fix breaks something, note it and move on +- Comments/docstrings referencing /home/aipass should be updated too — clean break from Dev-Pass + +--- + +## Definition of Done +All 5 success criteria pass in Docker container. diff --git a/src/aipass/devpulse/tests/conftest.py b/src/aipass/devpulse/tests/conftest.py index a87088fd..ac3aa382 100644 --- a/src/aipass/devpulse/tests/conftest.py +++ b/src/aipass/devpulse/tests/conftest.py @@ -1,5 +1,3 @@ -#!/home/aipass/.venv/bin/python3 - # ===================AIPASS==================== # META DATA HEADER # Name: tests/conftest.py diff --git a/src/aipass/drone/apps/modules/config.py b/src/aipass/drone/apps/modules/config.py index 958b780f..1b7934fc 100644 --- a/src/aipass/drone/apps/modules/config.py +++ b/src/aipass/drone/apps/modules/config.py @@ -37,8 +37,8 @@ def _find_registry() -> Path: if candidate.exists(): return candidate - # Fallback - return Path.home() / ".aipass" / "AIPASS_REGISTRY.json" + # Fallback — use package-relative path (no filesystem assumptions) + return Path(__file__).resolve().parents[4] / "AIPASS_REGISTRY.json" def get_registry_path() -> Path: diff --git a/src/aipass/drone/cli.py b/src/aipass/drone/cli.py index f2b56e32..66f45ba3 100644 --- a/src/aipass/drone/cli.py +++ b/src/aipass/drone/cli.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 """ Drone CLI — command-line interface for aipass.drone. diff --git a/src/aipass/drone/tests/conftest.py b/src/aipass/drone/tests/conftest.py index 0edced40..2054e078 100644 --- a/src/aipass/drone/tests/conftest.py +++ b/src/aipass/drone/tests/conftest.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 """Shared pytest fixtures for drone tests.""" import json diff --git a/src/aipass/flow/apps/flow.py b/src/aipass/flow/apps/flow.py index 0cca342a..aa49cb91 100755 --- a/src/aipass/flow/apps/flow.py +++ b/src/aipass/flow/apps/flow.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/flow/apps/handlers/__init__.py b/src/aipass/flow/apps/handlers/__init__.py index 55b99d27..8ad4fb72 100644 --- a/src/aipass/flow/apps/handlers/__init__.py +++ b/src/aipass/flow/apps/handlers/__init__.py @@ -45,7 +45,7 @@ def _extract_branch_name(filepath: str) -> str: """Extract branch name from a file path.""" parts = filepath.split("/") for i, part in enumerate(parts): - if part in ("aipass_core", "MEMORY_BANK", "Nexus"): + if part in ("aipass", "MEMORY_BANK", "Nexus"): if i + 1 < len(parts): return parts[i + 1] return "unknown" diff --git a/src/aipass/flow/apps/handlers/config/load_config.py b/src/aipass/flow/apps/handlers/config/load_config.py index 37d61bf1..ff362c90 100644 --- a/src/aipass/flow/apps/handlers/config/load_config.py +++ b/src/aipass/flow/apps/handlers/config/load_config.py @@ -1,5 +1,3 @@ -#!/home/aipass/.venv/bin/python3 -# -*- coding: utf-8 -*- # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/flow/apps/handlers/dashboard/__init__.py b/src/aipass/flow/apps/handlers/dashboard/__init__.py index c5147738..1a4bc67e 100644 --- a/src/aipass/flow/apps/handlers/dashboard/__init__.py +++ b/src/aipass/flow/apps/handlers/dashboard/__init__.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/flow/apps/handlers/dashboard/push_branch_dashboard.py b/src/aipass/flow/apps/handlers/dashboard/push_branch_dashboard.py index f1f68664..cf99f127 100644 --- a/src/aipass/flow/apps/handlers/dashboard/push_branch_dashboard.py +++ b/src/aipass/flow/apps/handlers/dashboard/push_branch_dashboard.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -39,7 +38,7 @@ Section Structure: { "managed_by": "flow", "active_plans": [ - {"id": "FPLAN-0373", "subject": "...", "created": "...", "location": "/home/aipass/..."} + {"id": "FPLAN-0373", "subject": "...", "created": "...", "location": "/path/to/branch"} ], "active_count": 2, "recently_closed": [ @@ -50,7 +49,7 @@ Section Structure: Usage: from aipass.flow.apps.handlers.dashboard.push_branch_dashboard import push_flow_to_branch_dashboard - success = push_flow_to_branch_dashboard(Path("/home/aipass/aipass_os/dev_central")) + success = push_flow_to_branch_dashboard(Path("/path/to/branch")) """ import json @@ -65,8 +64,8 @@ FLOW_ROOT = _PKG_ROOT / "flow" # Registry location REGISTRY_FILE = FLOW_ROOT / "flow_json" / "flow_registry.json" -# Dashboard template path -DASHBOARD_TEMPLATE_FILE = Path.home() / "aipass_os" / "dev_central" / "devpulse" / "templates" / "DASHBOARD.template.json" +# Dashboard template path (package-relative) +DASHBOARD_TEMPLATE_FILE = _PKG_ROOT / "devpulse" / "templates" / "DASHBOARD.template.json" # ============================================= @@ -328,7 +327,7 @@ def push_flow_to_branch_dashboard(branch_path: Path) -> bool: Args: branch_path: Absolute path to the branch directory - (e.g. Path("/home/aipass/aipass_os/dev_central")) + (e.g. Path("/repo/src/aipass/devpulse")) Returns: True if successfully written, False on any error diff --git a/src/aipass/flow/apps/handlers/dashboard/push_central.py b/src/aipass/flow/apps/handlers/dashboard/push_central.py index a932c609..f7e90195 100644 --- a/src/aipass/flow/apps/handlers/dashboard/push_central.py +++ b/src/aipass/flow/apps/handlers/dashboard/push_central.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -51,7 +50,17 @@ from aipass.flow.apps.modules.aggregate_central import aggregate_central MODULE_NAME = "push_central" FLOW_JSON_DIR = FLOW_ROOT / "flow_json" REGISTRY_FILE = FLOW_JSON_DIR / "flow_registry.json" -AI_CENTRAL_DIR = Path.home() / "aipass_os" / "AI_CENTRAL" +def _find_repo_root() -> Path: + """Walk up from this file to find the repo root (contains AIPASS_REGISTRY.json).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + + +_REPO_ROOT = _find_repo_root() +AI_CENTRAL_DIR = _REPO_ROOT / "AI_CENTRAL" CENTRAL_FILE = AI_CENTRAL_DIR / "PLANS.central.json" # ============================================= @@ -90,7 +99,7 @@ def _extract_flow_plans(registry: Dict[str, Any]) -> tuple[List[Dict], List[Dict for plan_num, plan_data in plans.items(): # Only include plans where location is 'flow' (Flow's own plans) location = plan_data.get("location", "") - if location != "/home/aipass/aipass_core/flow": + if location != str(FLOW_ROOT): continue # Build plan entry @@ -220,7 +229,7 @@ def push_to_plans_central() -> bool: "statistics": { "active_count": len(active_plans), "total_closed": len([p for p in registry.get("plans", {}).values() - if p.get("location") == "/home/aipass/aipass_core/flow" + if p.get("location") == str(FLOW_ROOT) and p.get("status") == "closed"]) } } diff --git a/src/aipass/flow/apps/handlers/dashboard/update_local.py b/src/aipass/flow/apps/handlers/dashboard/update_local.py index 0ff0f53e..3dc3d2aa 100644 --- a/src/aipass/flow/apps/handlers/dashboard/update_local.py +++ b/src/aipass/flow/apps/handlers/dashboard/update_local.py @@ -1,5 +1,3 @@ -#!/home/aipass/.venv/bin/python3 -# -*- coding: utf-8 -*- # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/flow/apps/handlers/json/json_handler.py b/src/aipass/flow/apps/handlers/json/json_handler.py index 07924703..faa9c291 100644 --- a/src/aipass/flow/apps/handlers/json/json_handler.py +++ b/src/aipass/flow/apps/handlers/json/json_handler.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -279,7 +278,7 @@ if __name__ == "__main__": update_data_metrics("flow", test_metric="working") console.print() - console.print("[green]Check /home/aipass/aipass_core/flow/flow_json/ for created files:[/green]") + console.print("[green]Check flow/flow_json/ for created files:[/green]") console.print(" [dim]•[/dim] flow_config.json") console.print(" [dim]•[/dim] flow_data.json") console.print(" [dim]•[/dim] flow_log.json") diff --git a/src/aipass/flow/apps/handlers/mbank/process.py b/src/aipass/flow/apps/handlers/mbank/process.py index 8805d678..144094fe 100644 --- a/src/aipass/flow/apps/handlers/mbank/process.py +++ b/src/aipass/flow/apps/handlers/mbank/process.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -52,9 +51,19 @@ from typing import Dict, List, Optional, Any FLOW_ROOT = _PKG_ROOT / "flow" FLOW_JSON_DIR = FLOW_ROOT / "flow_json" -MEMORY_BANK_PATH = Path.home() / "MEMORY_BANK" / "plans" +def _find_repo_root() -> Path: + """Walk up from this file to find the repo root (contains AIPASS_REGISTRY.json).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + + +_REPO_ROOT = _find_repo_root() +MEMORY_BANK_PATH = _REPO_ROOT / "MEMORY_BANK" / "plans" PROCESSED_PLANS_DIR = _PKG_ROOT / "backup_system" / "processed_plans" -PRIVATE_BRANCH_REGISTRY = Path.home() / "PRIVATE_BRANCH_REGISTRY.json" +PRIVATE_BRANCH_REGISTRY = _REPO_ROOT / "PRIVATE_BRANCH_REGISTRY.json" REGISTRY_FILE = FLOW_JSON_DIR / "flow_registry.json" CONFIG_FILE = FLOW_JSON_DIR / "flow_mbank_config.json" TRL_REGISTRY_FILE = FLOW_JSON_DIR / "flow_mbank_registry.json" diff --git a/src/aipass/flow/apps/handlers/plan/append_closed_plan.py b/src/aipass/flow/apps/handlers/plan/append_closed_plan.py index c4f85789..ff523826 100644 --- a/src/aipass/flow/apps/handlers/plan/append_closed_plan.py +++ b/src/aipass/flow/apps/handlers/plan/append_closed_plan.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/flow/apps/handlers/plan/auto_cleanup.py b/src/aipass/flow/apps/handlers/plan/auto_cleanup.py index 4f8c2824..338d44eb 100644 --- a/src/aipass/flow/apps/handlers/plan/auto_cleanup.py +++ b/src/aipass/flow/apps/handlers/plan/auto_cleanup.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/flow/apps/handlers/plan/build_registry_entry.py b/src/aipass/flow/apps/handlers/plan/build_registry_entry.py index b905c155..e29e72a3 100644 --- a/src/aipass/flow/apps/handlers/plan/build_registry_entry.py +++ b/src/aipass/flow/apps/handlers/plan/build_registry_entry.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -63,10 +62,10 @@ def build_plan_registry_entry( Example: >>> entry = build_plan_registry_entry( ... 1, - ... Path("/home/aipass/aipass_core/flow"), + ... Path("/repo/src/aipass/flow"), ... "flow", ... "My task", - ... Path("/home/aipass/aipass_core/flow/PLAN0001.md"), + ... Path("/repo/src/aipass/flow/PLAN0001.md"), ... "default" ... ) >>> entry["status"] diff --git a/src/aipass/flow/apps/handlers/plan/calculate_relative_path.py b/src/aipass/flow/apps/handlers/plan/calculate_relative_path.py index cdc27182..aec29efb 100644 --- a/src/aipass/flow/apps/handlers/plan/calculate_relative_path.py +++ b/src/aipass/flow/apps/handlers/plan/calculate_relative_path.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -46,20 +45,20 @@ def calculate_relative_location( Examples: >>> calculate_relative_location( - ... Path("/home/aipass/aipass_core/flow"), - ... Path("/home/aipass/aipass_core") + ... Path("/repo/src/aipass/flow"), + ... Path("/repo/src/aipass") ... ) "flow" >>> calculate_relative_location( - ... Path("/home/aipass/aipass_core"), - ... Path("/home/aipass/aipass_core") + ... Path("/repo/src/aipass"), + ... Path("/repo/src/aipass") ... ) "root" >>> calculate_relative_location( ... Path("/tmp/somewhere"), - ... Path("/home/aipass/aipass_core") + ... Path("/repo/src/aipass") ... ) "/tmp/somewhere" """ diff --git a/src/aipass/flow/apps/handlers/plan/command_parser.py b/src/aipass/flow/apps/handlers/plan/command_parser.py index 80798090..a17ad41e 100644 --- a/src/aipass/flow/apps/handlers/plan/command_parser.py +++ b/src/aipass/flow/apps/handlers/plan/command_parser.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/flow/apps/handlers/plan/confirmation.py b/src/aipass/flow/apps/handlers/plan/confirmation.py index 4bdd20c4..54d9243e 100644 --- a/src/aipass/flow/apps/handlers/plan/confirmation.py +++ b/src/aipass/flow/apps/handlers/plan/confirmation.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/flow/apps/handlers/plan/create.py b/src/aipass/flow/apps/handlers/plan/create.py index 13fab6a2..2af57d7d 100644 --- a/src/aipass/flow/apps/handlers/plan/create.py +++ b/src/aipass/flow/apps/handlers/plan/create.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/flow/apps/handlers/plan/create_file.py b/src/aipass/flow/apps/handlers/plan/create_file.py index 890288de..c7b824d8 100644 --- a/src/aipass/flow/apps/handlers/plan/create_file.py +++ b/src/aipass/flow/apps/handlers/plan/create_file.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/flow/apps/handlers/plan/display.py b/src/aipass/flow/apps/handlers/plan/display.py index 68e491d3..89b9df85 100644 --- a/src/aipass/flow/apps/handlers/plan/display.py +++ b/src/aipass/flow/apps/handlers/plan/display.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/flow/apps/handlers/plan/file_ops.py b/src/aipass/flow/apps/handlers/plan/file_ops.py index 355e1ae5..f3e75009 100644 --- a/src/aipass/flow/apps/handlers/plan/file_ops.py +++ b/src/aipass/flow/apps/handlers/plan/file_ops.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/flow/apps/handlers/plan/get_closed_plans.py b/src/aipass/flow/apps/handlers/plan/get_closed_plans.py index 07d940a6..69fa6bce 100644 --- a/src/aipass/flow/apps/handlers/plan/get_closed_plans.py +++ b/src/aipass/flow/apps/handlers/plan/get_closed_plans.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/flow/apps/handlers/plan/get_open_plans.py b/src/aipass/flow/apps/handlers/plan/get_open_plans.py index e0ac702d..2bf3b433 100644 --- a/src/aipass/flow/apps/handlers/plan/get_open_plans.py +++ b/src/aipass/flow/apps/handlers/plan/get_open_plans.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/flow/apps/handlers/plan/resolve_location.py b/src/aipass/flow/apps/handlers/plan/resolve_location.py index 83c20988..a69371fc 100644 --- a/src/aipass/flow/apps/handlers/plan/resolve_location.py +++ b/src/aipass/flow/apps/handlers/plan/resolve_location.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -56,13 +55,13 @@ def resolve_plan_location( - error_message: Empty string on success, error details on failure Examples: - >>> resolve_plan_location("/home/aipass/aipass_core/flow", Path("/home/aipass/aipass_core")) - (True, Path("/home/aipass/aipass_core/flow"), "") + >>> resolve_plan_location("/repo/src/aipass/flow", Path("/repo/src/aipass")) + (True, Path("/repo/src/aipass/flow"), "") - >>> resolve_plan_location(None, Path("/home/aipass/aipass_core")) + >>> resolve_plan_location(None, Path("/repo/src/aipass")) (True, Path.cwd(), "") - >>> resolve_plan_location("/nonexistent", Path("/home/aipass/aipass_core")) + >>> resolve_plan_location("/nonexistent", Path("/repo/src/aipass")) (False, Path.cwd(), "Directory /nonexistent does not exist") """ # Determine target directory diff --git a/src/aipass/flow/apps/handlers/plan/update_registry.py b/src/aipass/flow/apps/handlers/plan/update_registry.py index c6133184..805c9080 100644 --- a/src/aipass/flow/apps/handlers/plan/update_registry.py +++ b/src/aipass/flow/apps/handlers/plan/update_registry.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/flow/apps/handlers/plan/validator.py b/src/aipass/flow/apps/handlers/plan/validator.py index 88392604..6ea5ab79 100644 --- a/src/aipass/flow/apps/handlers/plan/validator.py +++ b/src/aipass/flow/apps/handlers/plan/validator.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/flow/apps/handlers/registry/load_registry.py b/src/aipass/flow/apps/handlers/registry/load_registry.py index 1fa46202..b9e5e093 100644 --- a/src/aipass/flow/apps/handlers/registry/load_registry.py +++ b/src/aipass/flow/apps/handlers/registry/load_registry.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/flow/apps/handlers/registry/save_registry.py b/src/aipass/flow/apps/handlers/registry/save_registry.py index 65afbf14..9dcdf61d 100644 --- a/src/aipass/flow/apps/handlers/registry/save_registry.py +++ b/src/aipass/flow/apps/handlers/registry/save_registry.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/flow/apps/handlers/registry/statistics.py b/src/aipass/flow/apps/handlers/registry/statistics.py index 267daf53..b721e4c8 100644 --- a/src/aipass/flow/apps/handlers/registry/statistics.py +++ b/src/aipass/flow/apps/handlers/registry/statistics.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/flow/apps/handlers/summary/generate.py(disabled) b/src/aipass/flow/apps/handlers/summary/generate.py(disabled) index caaee431..46c16230 100644 --- a/src/aipass/flow/apps/handlers/summary/generate.py(disabled) +++ b/src/aipass/flow/apps/handlers/summary/generate.py(disabled) @@ -1,4 +1,4 @@ -#!/home/aipass/.venv/bin/python3 +#!/usr/bin/env python3 # ===================AIPASS==================== # META DATA HEADER @@ -34,8 +34,7 @@ import time from datetime import datetime, timezone from typing import Dict, Any, Optional -AIPASS_ROOT = Path.home() / 'aipass_core' -sys.path.insert(0, str(AIPASS_ROOT)) +_PKG_ROOT = Path(__file__).resolve().parents[4] # generate.py -> summary/ -> handlers/ -> apps/ -> flow/ -> aipass/ # Import API provider for summarization (via module entry point - encapsulation) try: diff --git a/src/aipass/flow/apps/handlers/summary/write_plan_outputs.py b/src/aipass/flow/apps/handlers/summary/write_plan_outputs.py index 3c05177b..600867c1 100644 --- a/src/aipass/flow/apps/handlers/summary/write_plan_outputs.py +++ b/src/aipass/flow/apps/handlers/summary/write_plan_outputs.py @@ -1,5 +1,3 @@ -#!/home/aipass/.venv/bin/python3 -# -*- coding: utf-8 -*- # ===================AIPASS==================== # META DATA HEADER @@ -27,8 +25,8 @@ Features: - Reusable across Flow modules Global vs Local Pattern: -- **Global:** /home/aipass/CLAUDE.json (all plans, all branches) -- **Local:** /home/aipass/aipass_core/[branch]/CLAUDE.local.md (branch-specific) +- **Global:** {repo_root}/CLAUDE.json (all plans, all branches) +- **Local:** {repo_root}/src/aipass/[branch]/CLAUDE.local.md (branch-specific) Usage: from aipass.flow.apps.handlers.summary.write_plan_outputs import write_plan_outputs @@ -54,7 +52,19 @@ FLOW_ROOT = _PKG_ROOT / "flow" # ============================================= MODULE_NAME = "write_plan_outputs" -CLAUDE_JSON_FILE = Path.home() / "CLAUDE.json" + + +def _find_repo_root() -> Path: + """Walk up from this file to find the repo root (contains AIPASS_REGISTRY.json).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + + +_REPO_ROOT = _find_repo_root() +CLAUDE_JSON_FILE = _REPO_ROOT / "CLAUDE.json" # ============================================= # HELPER FUNCTIONS @@ -78,7 +88,7 @@ def _normalize_plan_entry(plan_num: str, info: Dict[str, Any]) -> Optional[Dict[ if file_path: path_obj = Path(file_path) if not path_obj.is_absolute(): - path_obj = Path.home() / file_path + path_obj = _PKG_ROOT / file_path branch_dir: Optional[Path] = None branch_relative_path = "" @@ -90,7 +100,7 @@ def _normalize_plan_entry(plan_num: str, info: Dict[str, Any]) -> Optional[Dict[ branch_dir = path_obj try: - branch_relative_path = str(path_obj.relative_to(Path.home())) + branch_relative_path = str(path_obj.relative_to(_PKG_ROOT)) except Exception: branch_relative_path = str(path_obj) else: @@ -103,7 +113,7 @@ def _normalize_plan_entry(plan_num: str, info: Dict[str, Any]) -> Optional[Dict[ if branch_dir is not None and not branch_name: try: - branch_name = branch_dir.relative_to(Path.home()).parts[0] + branch_name = branch_dir.relative_to(_PKG_ROOT).parts[0] except Exception: branch_name = branch_dir.name if branch_dir.name else "unknown" @@ -139,7 +149,7 @@ def _normalize_plan_entry(plan_num: str, info: Dict[str, Any]) -> Optional[Dict[ if branch_dir is not None: try: - branch_dir.relative_to(Path.home()) + branch_dir.relative_to(_PKG_ROOT) entry["branch_path"] = branch_dir except Exception: entry["branch_path"] = None @@ -322,7 +332,7 @@ def write_plan_outputs(summaries: Dict[str, Any], hide_empty: bool = True) -> bo ... "0001": { ... "summary": "Task description", ... "status": "open", - ... "file_path": "/home/aipass/aipass_core/flow/plans/FPLAN-0001.md", + ... "file_path": "flow/plans/FPLAN-0001.md", ... "subject": "Flow restructuring", ... "location": "flow", ... "is_empty": False diff --git a/src/aipass/flow/apps/handlers/template/get_template.py b/src/aipass/flow/apps/handlers/template/get_template.py index 5b696b15..b0e13c14 100644 --- a/src/aipass/flow/apps/handlers/template/get_template.py +++ b/src/aipass/flow/apps/handlers/template/get_template.py @@ -1,5 +1,3 @@ -#!/home/aipass/.venv/bin/python3 -# -*- coding: utf-8 -*- # ===================AIPASS==================== # META DATA HEADER @@ -21,7 +19,7 @@ Get Template Handler Loads and formats PLAN templates from template directories. Features: -- Loads templates from /home/aipass/aipass_core/templates/flow/ +- Loads templates from the flow/templates/ directory (package-relative) - Supports placeholder replacement ({number}, {subject}, {location}, {today}) - Automatic fallback to default template - Multi-directory search support diff --git a/src/aipass/flow/apps/handlers/template/list_templates.py b/src/aipass/flow/apps/handlers/template/list_templates.py index 9907e90c..b7e82310 100644 --- a/src/aipass/flow/apps/handlers/template/list_templates.py +++ b/src/aipass/flow/apps/handlers/template/list_templates.py @@ -1,5 +1,3 @@ -#!/home/aipass/.venv/bin/python3 -# -*- coding: utf-8 -*- # ===================AIPASS==================== # META DATA HEADER @@ -19,7 +17,7 @@ List Templates Handler Lists all available PLAN templates from template directories. Features: -- Scans /home/aipass/aipass_core/templates/flow/ +- Scans the package-relative templates/flow/ directory - Returns sorted list of template names - Multi-directory support - Reusable across Flow modules diff --git a/src/aipass/flow/apps/modules/aggregate_central.py b/src/aipass/flow/apps/modules/aggregate_central.py index edc27b84..52bacf70 100755 --- a/src/aipass/flow/apps/modules/aggregate_central.py +++ b/src/aipass/flow/apps/modules/aggregate_central.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -66,7 +65,19 @@ from aipass.cli.apps.modules import console # ============================================= MODULE_NAME = "aggregate_central" -AI_CENTRAL_DIR = Path.home() / "aipass_os" / "AI_CENTRAL" + + +def _find_repo_root() -> Path: + """Walk up from this file to find the repo root (contains AIPASS_REGISTRY.json).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + + +_REPO_ROOT = _find_repo_root() +AI_CENTRAL_DIR = _REPO_ROOT / "AI_CENTRAL" CENTRAL_FILE = AI_CENTRAL_DIR / "PLANS.central.json" # ============================================= diff --git a/src/aipass/flow/apps/modules/close_plan.py b/src/aipass/flow/apps/modules/close_plan.py index c13fd220..b4b24294 100644 --- a/src/aipass/flow/apps/modules/close_plan.py +++ b/src/aipass/flow/apps/modules/close_plan.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/flow/apps/modules/create_plan.py b/src/aipass/flow/apps/modules/create_plan.py index 45273fc5..6237c4ef 100755 --- a/src/aipass/flow/apps/modules/create_plan.py +++ b/src/aipass/flow/apps/modules/create_plan.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/flow/apps/modules/list_plans.py b/src/aipass/flow/apps/modules/list_plans.py index a37d2bc6..3d3eb853 100755 --- a/src/aipass/flow/apps/modules/list_plans.py +++ b/src/aipass/flow/apps/modules/list_plans.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/flow/apps/modules/post_close_runner.py b/src/aipass/flow/apps/modules/post_close_runner.py index bb5518d6..13cb5220 100644 --- a/src/aipass/flow/apps/modules/post_close_runner.py +++ b/src/aipass/flow/apps/modules/post_close_runner.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/flow/apps/modules/registry_monitor.py b/src/aipass/flow/apps/modules/registry_monitor.py index 750b78a2..a4115224 100644 --- a/src/aipass/flow/apps/modules/registry_monitor.py +++ b/src/aipass/flow/apps/modules/registry_monitor.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -80,7 +79,19 @@ from aipass.flow.apps.handlers.registry.save_registry import save_registry # ============================================= MODULE_NAME = "registry_monitor" -ECOSYSTEM_ROOT = Path("/home/aipass") # Start from /home/aipass, not root / + + +def _find_repo_root() -> Path: + """Walk up from this file to find the repo root (contains AIPASS_REGISTRY.json).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + + +REPO_ROOT = _find_repo_root() +ECOSYSTEM_ROOT = REPO_ROOT # Scan from repo root FLOW_JSON_DIR = FLOW_ROOT / "flow_json" # PLAN file pattern @@ -644,7 +655,7 @@ def print_help(): console.print(" - Preserve metadata on file moves (status, closed date, etc.)") console.print(" - Detect and fix orphaned registry entries") console.print(" - Auto-renumber duplicate plan numbers") - console.print(" - System-wide scanning from /home/aipass") + console.print(" - System-wide scanning from repo root") console.print(" - Ignore common directories (.git, backups, etc.)") console.print() diff --git a/src/aipass/flow/apps/modules/restore_plan.py b/src/aipass/flow/apps/modules/restore_plan.py index 6f1f6650..02def07a 100644 --- a/src/aipass/flow/apps/modules/restore_plan.py +++ b/src/aipass/flow/apps/modules/restore_plan.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -136,7 +135,7 @@ def recover_plan_from_backup(plan_key: str) -> tuple[bool, str]: with open(plan_file, 'r', encoding='utf-8') as f: content = f.read() - # Parse location from header (e.g., "**Location**: /home/aipass") + # Parse location from header (e.g., "**Location**: /path/to/dir") original_location = None for line in content.split('\n')[:20]: # Check first 20 lines if line.startswith("**Location**:"): @@ -150,38 +149,27 @@ def recover_plan_from_backup(plan_key: str) -> tuple[bool, str]: # CRITICAL: Convert relative paths to absolute paths # If location is relative (like "flow"), resolve it if not original_location.startswith('/'): - # Relative path - resolve it + # Relative path - resolve against _PKG_ROOT if original_location == "flow": original_location = str(FLOW_ROOT) - elif original_location == "aipass_core": - original_location = str(_PKG_ROOT) - elif original_location == "seed": - original_location = str(Path.home() / "seed") else: # Try resolving relative to _PKG_ROOT potential_path = _PKG_ROOT / original_location if potential_path.exists(): original_location = str(potential_path) else: - # Try relative to home - potential_path = Path.home() / original_location - if potential_path.exists(): - original_location = str(potential_path) - else: - # Fallback to FLOW_ROOT - original_location = str(FLOW_ROOT) + # Fallback to FLOW_ROOT + original_location = str(FLOW_ROOT) # Determine relative path original_path = Path(original_location) if original_path == FLOW_ROOT: relative_path = "flow" elif original_path == _PKG_ROOT: - relative_path = "aipass_core" - elif original_path == Path.home(): - relative_path = str(Path.home()) + relative_path = "root" else: try: - relative_path = str(original_path.relative_to(Path.home())) + relative_path = str(original_path.relative_to(_PKG_ROOT)) except ValueError: relative_path = str(original_path) diff --git a/src/aipass/flow/flow_json/close_plan_config.json b/src/aipass/flow/flow_json/close_plan_config.json new file mode 100644 index 00000000..385cdcf4 --- /dev/null +++ b/src/aipass/flow/flow_json/close_plan_config.json @@ -0,0 +1,9 @@ +{ + "module_name": "close_plan", + "version": "1.0.0", + "timestamp": "2025-11-13", + "config": { + "auto_save": true, + "enabled": true + } +} \ No newline at end of file diff --git a/src/aipass/flow/flow_json/close_plan_data.json b/src/aipass/flow/flow_json/close_plan_data.json new file mode 100644 index 00000000..dff019bd --- /dev/null +++ b/src/aipass/flow/flow_json/close_plan_data.json @@ -0,0 +1,8 @@ +{ + "module_name": "close_plan", + "created": "2025-11-13", + "last_updated": "2025-11-13", + "operations_total": 0, + "operations_successful": 0, + "operations_failed": 0 +} \ No newline at end of file diff --git a/src/aipass/flow/flow_json/close_plan_log.json b/src/aipass/flow/flow_json/close_plan_log.json new file mode 100644 index 00000000..d512b01a --- /dev/null +++ b/src/aipass/flow/flow_json/close_plan_log.json @@ -0,0 +1,23 @@ +[ + { + "timestamp": "2026-03-06T19:26:52.582808", + "operation": "plan_closed", + "data": { + "command": "close", + "args": [ + "FPLAN-0001", + "--yes" + ] + } + }, + { + "timestamp": "2026-03-06T20:21:02.790344", + "operation": "plan_closed", + "data": { + "command": "close", + "args": [ + "0002" + ] + } + } +] \ No newline at end of file diff --git a/src/aipass/flow/flow_json/create_plan_config.json b/src/aipass/flow/flow_json/create_plan_config.json new file mode 100644 index 00000000..f6fd0426 --- /dev/null +++ b/src/aipass/flow/flow_json/create_plan_config.json @@ -0,0 +1,9 @@ +{ + "module_name": "create_plan", + "version": "1.0.0", + "timestamp": "2025-11-13", + "config": { + "auto_save": true, + "enabled": true + } +} \ No newline at end of file diff --git a/src/aipass/flow/flow_json/create_plan_data.json b/src/aipass/flow/flow_json/create_plan_data.json new file mode 100644 index 00000000..365b7e3f --- /dev/null +++ b/src/aipass/flow/flow_json/create_plan_data.json @@ -0,0 +1,8 @@ +{ + "module_name": "create_plan", + "created": "2025-11-13", + "last_updated": "2025-11-13", + "operations_total": 0, + "operations_successful": 0, + "operations_failed": 0 +} \ No newline at end of file diff --git a/src/aipass/flow/flow_json/create_plan_log.json b/src/aipass/flow/flow_json/create_plan_log.json new file mode 100644 index 00000000..6d7bb244 --- /dev/null +++ b/src/aipass/flow/flow_json/create_plan_log.json @@ -0,0 +1,21 @@ +[ + { + "timestamp": "2026-03-06T19:26:45.708820", + "operation": "plan_created", + "data": { + "command": "create", + "args": [ + "/tmp", + "Test plan from devpulse" + ] + } + }, + { + "timestamp": "2026-03-06T20:20:39.984820", + "operation": "plan_created", + "data": { + "command": "create", + "args": [] + } + } +] \ No newline at end of file diff --git a/src/aipass/flow/flow_json/flow_registry.json b/src/aipass/flow/flow_json/flow_registry.json new file mode 100644 index 00000000..d07cd2d1 --- /dev/null +++ b/src/aipass/flow/flow_json/flow_registry.json @@ -0,0 +1,5 @@ +{ + "plans": {}, + "next_number": 3, + "last_updated": "2026-03-06T20:21:02.795560+00:00" +} \ No newline at end of file diff --git a/src/aipass/flow/flow_json/list_plans_config.json b/src/aipass/flow/flow_json/list_plans_config.json new file mode 100644 index 00000000..8392dbc7 --- /dev/null +++ b/src/aipass/flow/flow_json/list_plans_config.json @@ -0,0 +1,9 @@ +{ + "module_name": "list_plans", + "version": "1.0.0", + "timestamp": "2025-11-13", + "config": { + "auto_save": true, + "enabled": true + } +} \ No newline at end of file diff --git a/src/aipass/flow/flow_json/list_plans_data.json b/src/aipass/flow/flow_json/list_plans_data.json new file mode 100644 index 00000000..6eb3017f --- /dev/null +++ b/src/aipass/flow/flow_json/list_plans_data.json @@ -0,0 +1,8 @@ +{ + "module_name": "list_plans", + "created": "2025-11-13", + "last_updated": "2025-11-13", + "operations_total": 0, + "operations_successful": 0, + "operations_failed": 0 +} \ No newline at end of file diff --git a/src/aipass/flow/flow_json/list_plans_log.json b/src/aipass/flow/flow_json/list_plans_log.json new file mode 100644 index 00000000..5515a66f --- /dev/null +++ b/src/aipass/flow/flow_json/list_plans_log.json @@ -0,0 +1,18 @@ +[ + { + "timestamp": "2026-03-06T19:25:53.833365", + "operation": "plans_listed", + "data": { + "command": "list", + "args": [] + } + }, + { + "timestamp": "2026-03-06T19:26:49.120795", + "operation": "plans_listed", + "data": { + "command": "list", + "args": [] + } + } +] \ No newline at end of file diff --git a/src/aipass/flow/tests/conftest.py b/src/aipass/flow/tests/conftest.py index a87088fd..3cccc54b 100644 --- a/src/aipass/flow/tests/conftest.py +++ b/src/aipass/flow/tests/conftest.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/prax/apps/handlers/__init__.py b/src/aipass/prax/apps/handlers/__init__.py index ae41690f..06135a4e 100755 --- a/src/aipass/prax/apps/handlers/__init__.py +++ b/src/aipass/prax/apps/handlers/__init__.py @@ -3,7 +3,7 @@ import inspect from pathlib import Path -MY_BRANCH = "prax" +MY_BRANCH = "aipass.prax" def _find_real_caller(): @@ -45,7 +45,7 @@ def _extract_branch_name(filepath: str) -> str: """Extract branch name from a file path.""" parts = filepath.split("/") for i, part in enumerate(parts): - if part in ("aipass_core", "MEMORY_BANK", "Nexus"): + if part == "aipass": if i + 1 < len(parts): return parts[i + 1] return "unknown" @@ -56,7 +56,7 @@ def _guard_branch_access(): Block cross-branch handler imports. Only code from within the 'prax' branch can import these handlers. - External branches must use prax.apps.modules instead. + External branches must use aipass.prax.apps.modules instead. """ caller_file, import_line = _find_real_caller() @@ -99,7 +99,9 @@ def _guard_branch_access(): return # Allow if truly can't determine # Check if caller is from our branch - if f"/{MY_BRANCH}/" in caller_file: + # MY_BRANCH is "aipass.prax" (dotted), but filesystem uses "/aipass/prax/" + branch_path = "/" + MY_BRANCH.replace(".", "/") + "/" + if branch_path in caller_file: return # Same branch, allowed # External caller - block access diff --git a/src/aipass/prax/apps/handlers/config/ignore_patterns.py b/src/aipass/prax/apps/handlers/config/ignore_patterns.py index c8550b10..14d5074b 100755 --- a/src/aipass/prax/apps/handlers/config/ignore_patterns.py +++ b/src/aipass/prax/apps/handlers/config/ignore_patterns.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/prax/apps/handlers/config/load.py b/src/aipass/prax/apps/handlers/config/load.py index 31ac46a1..2c04bb35 100755 --- a/src/aipass/prax/apps/handlers/config/load.py +++ b/src/aipass/prax/apps/handlers/config/load.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -48,11 +47,28 @@ MODULE_NAME = "load" # Package path resolution (no hardcoded paths) PRAX_ROOT = Path(__file__).resolve().parents[3] # config/load.py → handlers/ → apps/ → prax/ ECOSYSTEM_ROOT = PRAX_ROOT.parent # prax/ → aipass/ (contains all sibling modules) -SYSTEM_LOGS_DIR = Path.home() / "system_logs" PRAX_JSON_DIR = PRAX_ROOT / "prax_json" -# Self-healing: ensure SYSTEM_LOGS_DIR exists -SYSTEM_LOGS_DIR.mkdir(parents=True, exist_ok=True) +def _find_repo_root() -> Path: + """Walk up from this file to find the repo root (contains AIPASS_REGISTRY.json).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + +# Lazy SYSTEM_LOGS_DIR — resolved on first access, not at import time. +# Callers should use get_system_logs_dir() for guaranteed initialization. +_system_logs_dir_cache: Path | None = None + +def get_system_logs_dir() -> Path: + """Lazily resolve and create system_logs directory (package-relative).""" + global _system_logs_dir_cache + if _system_logs_dir_cache is None: + repo_root = _find_repo_root() + _system_logs_dir_cache = repo_root / "system_logs" + _system_logs_dir_cache.mkdir(parents=True, exist_ok=True) + return _system_logs_dir_cache # Config file PRAX_LOGGER_CONFIG_FILE = PRAX_JSON_DIR / "prax_logger_config.json" diff --git a/src/aipass/prax/apps/handlers/dashboard/__init__.py b/src/aipass/prax/apps/handlers/dashboard/__init__.py index 13d196dd..0601fb0e 100644 --- a/src/aipass/prax/apps/handlers/dashboard/__init__.py +++ b/src/aipass/prax/apps/handlers/dashboard/__init__.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 """ Dashboard Handlers Package diff --git a/src/aipass/prax/apps/handlers/dashboard/agent_status_writer.py b/src/aipass/prax/apps/handlers/dashboard/agent_status_writer.py index e11d12ea..4c847c4e 100644 --- a/src/aipass/prax/apps/handlers/dashboard/agent_status_writer.py +++ b/src/aipass/prax/apps/handlers/dashboard/agent_status_writer.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -42,7 +41,18 @@ from typing import Any, Dict, List # CONSTANTS # ============================================================================= -BRANCH_REGISTRY = Path.home() / "BRANCH_REGISTRY.json" +def _find_repo_root() -> Path: + """Walk up from this file to find the repo root (contains AIPASS_REGISTRY.json).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + +def _get_branch_registry() -> Path: + """Lazily resolve AIPASS_REGISTRY.json path.""" + return _find_repo_root() / "AIPASS_REGISTRY.json" + STALE_THRESHOLD_MINUTES = 120 @@ -58,10 +68,11 @@ def _get_all_branches() -> List[Dict[str, Any]]: List of dicts with 'name' and 'path' keys """ try: - if not BRANCH_REGISTRY.exists(): + registry = _get_branch_registry() + if not registry.exists(): return [] - data = json.loads(BRANCH_REGISTRY.read_text(encoding="utf-8")) + data = json.loads(registry.read_text(encoding="utf-8")) branches = [] for branch in data.get("branches", []): branch_path = Path(branch.get("path", "")) @@ -241,7 +252,6 @@ def _write_section_to_all_branches(section_name: str, section_data: Dict, script = ( "import sys, json\n" "from pathlib import Path\n" - f"sys.path.insert(0, '{Path.home() / 'aipass_os' / 'dev_central'}')\n" "from aipass.devpulse.apps.modules.dashboard import write_section\n" "data = json.loads(sys.stdin.read())\n" "section_name = data['section_name']\n" diff --git a/src/aipass/prax/apps/handlers/discovery/filtering.py b/src/aipass/prax/apps/handlers/discovery/filtering.py index 2d8fa17a..44e29457 100755 --- a/src/aipass/prax/apps/handlers/discovery/filtering.py +++ b/src/aipass/prax/apps/handlers/discovery/filtering.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/prax/apps/handlers/discovery/scanner.py b/src/aipass/prax/apps/handlers/discovery/scanner.py index 389c1392..2e9f1630 100755 --- a/src/aipass/prax/apps/handlers/discovery/scanner.py +++ b/src/aipass/prax/apps/handlers/discovery/scanner.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -31,7 +30,7 @@ from typing import Dict, Any # Import from prax config from aipass.prax.apps.handlers.config.load import ( ECOSYSTEM_ROOT, - SYSTEM_LOGS_DIR + get_system_logs_dir ) # Import filtering @@ -63,7 +62,7 @@ def scan_directory_safely(directory: Path, modules: Dict, max_depth: int = 10): modules[module_name] = { "file_path": str(item), "relative_path": str(relative_path), - "log_file": str(SYSTEM_LOGS_DIR / f"prax_{module_name}.log"), + "log_file": str(get_system_logs_dir() / f"prax_{module_name}.log"), "discovered_time": datetime.now(timezone.utc).isoformat(), "size": item.stat().st_size, "modified_time": datetime.fromtimestamp(item.stat().st_mtime).isoformat(), diff --git a/src/aipass/prax/apps/handlers/discovery/watcher.py b/src/aipass/prax/apps/handlers/discovery/watcher.py index ba3d05f7..9515c4f9 100755 --- a/src/aipass/prax/apps/handlers/discovery/watcher.py +++ b/src/aipass/prax/apps/handlers/discovery/watcher.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -33,7 +32,7 @@ from watchdog.events import FileSystemEventHandler # Import from prax config from aipass.prax.apps.handlers.config.load import ( ECOSYSTEM_ROOT, - SYSTEM_LOGS_DIR + get_system_logs_dir ) # Import from prax registry handlers @@ -76,7 +75,7 @@ class PythonFileWatcher(FileSystemEventHandler): modules[module_name] = { "file_path": str(py_file), "relative_path": str(relative_path), - "log_file": str(SYSTEM_LOGS_DIR / f"prax_{module_name}.log"), + "log_file": str(get_system_logs_dir() / f"prax_{module_name}.log"), "discovered_time": datetime.now(timezone.utc).isoformat(), "size": py_file.stat().st_size, "modified_time": datetime.fromtimestamp(py_file.stat().st_mtime).isoformat(), diff --git a/src/aipass/prax/apps/handlers/json/initialize.py b/src/aipass/prax/apps/handlers/json/initialize.py index e4880d75..f576694a 100755 --- a/src/aipass/prax/apps/handlers/json/initialize.py +++ b/src/aipass/prax/apps/handlers/json/initialize.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/prax/apps/handlers/json/json_handler.py b/src/aipass/prax/apps/handlers/json/json_handler.py index 76a6f6e3..8c02d95f 100755 --- a/src/aipass/prax/apps/handlers/json/json_handler.py +++ b/src/aipass/prax/apps/handlers/json/json_handler.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -270,7 +269,7 @@ if __name__ == "__main__": increment_counter("prax", "test_counter", 1) update_data_metrics("prax", test_metric="working") - print("\nCheck /home/aipass/aipass_core/prax/prax_json/ for created files:") + print("\nCheck src/aipass/prax/prax_json/ for created files:") print(" - prax_config.json") print(" - prax_data.json") print(" - prax_log.json") diff --git a/src/aipass/prax/apps/handlers/json/load.py b/src/aipass/prax/apps/handlers/json/load.py index ad2e3f3f..7a4441e8 100755 --- a/src/aipass/prax/apps/handlers/json/load.py +++ b/src/aipass/prax/apps/handlers/json/load.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/prax/apps/handlers/json/log.py b/src/aipass/prax/apps/handlers/json/log.py index 6635abb6..6e06a9fd 100755 --- a/src/aipass/prax/apps/handlers/json/log.py +++ b/src/aipass/prax/apps/handlers/json/log.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/prax/apps/handlers/json/save.py b/src/aipass/prax/apps/handlers/json/save.py index c6539903..4797998b 100755 --- a/src/aipass/prax/apps/handlers/json/save.py +++ b/src/aipass/prax/apps/handlers/json/save.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/prax/apps/handlers/logging/cli_commands.py b/src/aipass/prax/apps/handlers/logging/cli_commands.py index e70da7ac..88bf68b4 100755 --- a/src/aipass/prax/apps/handlers/logging/cli_commands.py +++ b/src/aipass/prax/apps/handlers/logging/cli_commands.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/prax/apps/handlers/logging/direct.py b/src/aipass/prax/apps/handlers/logging/direct.py index c2db0ba5..f612bc73 100644 --- a/src/aipass/prax/apps/handlers/logging/direct.py +++ b/src/aipass/prax/apps/handlers/logging/direct.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -51,7 +50,7 @@ from logging.handlers import RotatingFileHandler from typing import Dict, Optional, Tuple from aipass.prax.apps.handlers.config.load import ( - SYSTEM_LOGS_DIR, + get_system_logs_dir, DEFAULT_LOG_LEVEL, load_log_config, lines_to_bytes @@ -109,7 +108,7 @@ def _create_direct_logger( Args: module_name: Name of the calling module (e.g., 'log_watcher') branch_name: Short branch name (e.g., 'prax', 'trigger', 'api') - branch_path: Full branch path (e.g., 'aipass_core/prax') or None + branch_path: Module/branch name (e.g., 'prax') or None Returns: Configured logger with dual file handlers and no propagation. @@ -128,7 +127,7 @@ def _create_direct_logger( ) # Handler 1: System-wide log - SYS_LOG_FILE = SYSTEM_LOGS_DIR / f"{branch_name}_{module_name}.log" + SYS_LOG_FILE = get_system_logs_dir() / f"{branch_name}_{module_name}.log" SYS_LIMITS = config['system_logs'] sys_handler = RotatingFileHandler( SYS_LOG_FILE, @@ -141,7 +140,8 @@ def _create_direct_logger( # Handler 2: Branch-local log if branch_path: - LOCAL_LOGS_DIR = Path.home() / branch_path / "logs" + from aipass.prax.apps.handlers.config.load import _find_repo_root + LOCAL_LOGS_DIR = _find_repo_root() / branch_path / "logs" LOCAL_LOGS_DIR.mkdir(parents=True, exist_ok=True) LOCAL_LOG_FILE = LOCAL_LOGS_DIR / f"{module_name}.log" LOCAL_LIMITS = config['local_logs'] diff --git a/src/aipass/prax/apps/handlers/logging/introspection.py b/src/aipass/prax/apps/handlers/logging/introspection.py index 2a781957..bc14359a 100755 --- a/src/aipass/prax/apps/handlers/logging/introspection.py +++ b/src/aipass/prax/apps/handlers/logging/introspection.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -83,14 +82,16 @@ def get_calling_module_path() -> Optional[str]: def detect_branch_from_path(module_path: str) -> Optional[str]: """Detect branch name from module file path + The package structure is: .../src/aipass/{module}/apps/... + Find "aipass" in path parts, then the next part is the module name. + Examples: - /home/aipass/aipass_core/flow/apps/module.py → "aipass_core/flow" - /home/aipass/aipass_core/cortex/apps/module.py → "aipass_core/cortex" - /home/aipass/aipass_core/prax/apps/module.py → "aipass_core/prax" - /home/aipass/other_dir/module.py → "other_dir" + .../src/aipass/flow/apps/module.py → "flow" + .../src/aipass/prax/apps/module.py → "prax" + .../src/aipass/drone/apps/branch.py → "drone" Returns: - Branch path (e.g., "aipass_core/flow") or None + Module/branch name (e.g., "flow") or None """ if not module_path: return None @@ -98,27 +99,15 @@ def detect_branch_from_path(module_path: str) -> Optional[str]: path = Path(module_path) parts = path.parts - # Find /home/aipass in path + # Find "aipass" in path parts and return the next part (the module name) + # Package structure: .../src/aipass/{module}/apps/... try: aipass_idx = parts.index('aipass') - - # Check if this is aipass_core structure - if aipass_idx + 1 < len(parts) and parts[aipass_idx + 1] == 'aipass_core': - # For aipass_core, we want aipass_core/module_name format - # e.g., /home/aipass/aipass_core/flow/apps/module.py → "aipass_core/flow" + if aipass_idx + 1 < len(parts): + module_name = parts[aipass_idx + 1] + # Ensure there's more after it (not just a file in the aipass dir) if aipass_idx + 2 < len(parts): - module_folder = parts[aipass_idx + 2] - # Make sure it's not just a file in aipass_core root - if aipass_idx + 3 < len(parts): - return f"aipass_core/{module_folder}" - else: - # For other structures, return the folder after aipass - # e.g., /home/aipass/some_project/module.py → "some_project" - if aipass_idx + 1 < len(parts): - potential_branch = parts[aipass_idx + 1] - # Skip if it's a file directly in /home/aipass - if aipass_idx + 2 < len(parts): - return potential_branch + return module_name except ValueError: pass diff --git a/src/aipass/prax/apps/handlers/logging/log_watchdog.py b/src/aipass/prax/apps/handlers/logging/log_watchdog.py index e456eb59..903bf266 100644 --- a/src/aipass/prax/apps/handlers/logging/log_watchdog.py +++ b/src/aipass/prax/apps/handlers/logging/log_watchdog.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -19,7 +18,7 @@ """ System Log Size Watchdog -Scans /home/aipass/system_logs/ for oversized log files and enforces size limits. +Scans the system_logs/ directory for oversized log files and enforces size limits. Catches ALL log files regardless of how they were created — even those bypassing PRAX's RotatingFileHandler (e.g., telegram bots using plain FileHandler). @@ -41,7 +40,22 @@ from typing import Any, Dict, List, Tuple # CONSTANTS # ============================================================================= -SYSTEM_LOGS_DIR = Path.home() / "system_logs" +def _find_repo_root() -> Path: + """Walk up from this file to find the repo root (contains AIPASS_REGISTRY.json).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + +_system_logs_dir_cache: Path | None = None + +def _get_system_logs_dir() -> Path: + """Lazily resolve system_logs directory (package-relative).""" + global _system_logs_dir_cache + if _system_logs_dir_cache is None: + _system_logs_dir_cache = _find_repo_root() / "system_logs" + return _system_logs_dir_cache # Thresholds WARN_THRESHOLD_LINES = 5000 # Fire warning at this line count @@ -96,10 +110,10 @@ def scan_log_files() -> List[Dict[str, Any]]: """ results: List[Dict[str, Any]] = [] - if not SYSTEM_LOGS_DIR.exists(): + if not _get_system_logs_dir().exists(): return results - for log_file in sorted(SYSTEM_LOGS_DIR.glob("*.log")): + for log_file in sorted(_get_system_logs_dir().glob("*.log")): lines = _count_lines(log_file) size_kb = _get_file_size_kb(log_file) diff --git a/src/aipass/prax/apps/handlers/logging/monitoring.py b/src/aipass/prax/apps/handlers/logging/monitoring.py index eb83bc6f..8ec55cc5 100755 --- a/src/aipass/prax/apps/handlers/logging/monitoring.py +++ b/src/aipass/prax/apps/handlers/logging/monitoring.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/prax/apps/handlers/logging/operations.py b/src/aipass/prax/apps/handlers/logging/operations.py index fa76fcf2..27faedb6 100755 --- a/src/aipass/prax/apps/handlers/logging/operations.py +++ b/src/aipass/prax/apps/handlers/logging/operations.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/prax/apps/handlers/logging/override.py b/src/aipass/prax/apps/handlers/logging/override.py index ab6a5f2c..0bafb139 100755 --- a/src/aipass/prax/apps/handlers/logging/override.py +++ b/src/aipass/prax/apps/handlers/logging/override.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/prax/apps/handlers/logging/setup.py b/src/aipass/prax/apps/handlers/logging/setup.py index a78af824..25dd3b1f 100755 --- a/src/aipass/prax/apps/handlers/logging/setup.py +++ b/src/aipass/prax/apps/handlers/logging/setup.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -26,7 +25,7 @@ from logging.handlers import RotatingFileHandler # Import from prax config from aipass.prax.apps.handlers.config.load import ( - SYSTEM_LOGS_DIR, + get_system_logs_dir, DEFAULT_LOG_LEVEL, load_log_config, lines_to_bytes @@ -59,8 +58,8 @@ def setup_individual_logger(module_name: str) -> logging.Logger: """Setup individual logger for a specific module with dual logging support Creates: - - System-wide log: /home/aipass/system_logs/prax_{module_name}.log - - Branch-local log: /home/aipass/{branch}/logs/{module_name}.log (if in a branch) + - System-wide log: {repo_root}/system_logs/prax_{module_name}.log + - Branch-local log: {repo_root}/src/aipass/{branch}/logs/{module_name}.log (if in a branch) - Terminal handler (if enabled) Args: @@ -89,9 +88,8 @@ def setup_individual_logger(module_name: str) -> logging.Logger: branch_path = detect_branch_from_path(module_path) if module_path else None # Extract branch name from path - # "aipass_core/cortex" → "cortex" - # "aipass_core/flow" → "flow" - # "some_project" → "some_project" + # "prax" → "prax" + # "flow" → "flow" if branch_path: branch_name = branch_path.split('/')[-1] else: @@ -104,7 +102,7 @@ def setup_individual_logger(module_name: str) -> logging.Logger: ) # HANDLER 1: System-wide log (named after calling branch) - system_log_file = SYSTEM_LOGS_DIR / f"{branch_name}_{module_name}.log" + system_log_file = get_system_logs_dir() / f"{branch_name}_{module_name}.log" system_limits = log_config['system_logs'] system_max_bytes = lines_to_bytes(system_limits['max_lines']) system_handler = RotatingFileHandler( @@ -121,8 +119,9 @@ def setup_individual_logger(module_name: str) -> logging.Logger: if branch: # Create branch logs directory if it doesn't exist - # Branch format is now "aipass_core/module" or "project_name" - branch_logs_dir = Path.home() / branch / "logs" + # Use repo-relative path for branch logs + from aipass.prax.apps.handlers.config.load import _find_repo_root + branch_logs_dir = _find_repo_root() / branch / "logs" branch_logs_dir.mkdir(parents=True, exist_ok=True) # Create branch-local log file @@ -179,7 +178,7 @@ def setup_system_logger() -> logging.Logger: _system_logger.handlers.clear() # Create prax_logger's own log file - log_file = SYSTEM_LOGS_DIR / "prax_logger.log" + log_file = get_system_logs_dir() / "prax_logger.log" # Create rotating file handler with config-driven limits system_limits = log_config['system_logs'] diff --git a/src/aipass/prax/apps/handlers/logging/terminal/filtering.py b/src/aipass/prax/apps/handlers/logging/terminal/filtering.py index 63934c75..7ca5422c 100755 --- a/src/aipass/prax/apps/handlers/logging/terminal/filtering.py +++ b/src/aipass/prax/apps/handlers/logging/terminal/filtering.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/prax/apps/handlers/logging/terminal/formatting.py b/src/aipass/prax/apps/handlers/logging/terminal/formatting.py index dacb1e49..08a297ab 100755 --- a/src/aipass/prax/apps/handlers/logging/terminal/formatting.py +++ b/src/aipass/prax/apps/handlers/logging/terminal/formatting.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/prax/apps/handlers/monitoring/INTEGRATION_EXAMPLE.py b/src/aipass/prax/apps/handlers/monitoring/INTEGRATION_EXAMPLE.py index 1068d873..1094abcf 100644 --- a/src/aipass/prax/apps/handlers/monitoring/INTEGRATION_EXAMPLE.py +++ b/src/aipass/prax/apps/handlers/monitoring/INTEGRATION_EXAMPLE.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 """ Example: File Watcher Integration with monitor_module.py @@ -124,7 +123,7 @@ def example_custom_event_handling(): watcher.start() print("Watching PRAX branch for 30 seconds...") - print("Try modifying a file in /home/aipass/aipass_core/prax/") + print("Try modifying a file in src/aipass/prax/") print() import time diff --git a/src/aipass/prax/apps/handlers/monitoring/MONITOR_MODULE_INTEGRATION.py b/src/aipass/prax/apps/handlers/monitoring/MONITOR_MODULE_INTEGRATION.py index 77411b84..6ed78a65 100644 --- a/src/aipass/prax/apps/handlers/monitoring/MONITOR_MODULE_INTEGRATION.py +++ b/src/aipass/prax/apps/handlers/monitoring/MONITOR_MODULE_INTEGRATION.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 """ EXAMPLE: How to integrate log_watcher into monitor_module.py @@ -60,7 +59,7 @@ def handle_command(command: str, args: List[str]) -> bool: try: _log_observer = start_log_watcher(_event_queue) console.print("[green]✓ Log watcher started[/green]") - console.print(f"[dim] Monitoring: /home/aipass/system_logs/*.log[/dim]") + console.print(f"[dim] Monitoring: system_logs/*.log[/dim]") except Exception as e: error(f"Failed to start log watcher: {e}") logger.error(f"Log watcher startup failed: {e}") diff --git a/src/aipass/prax/apps/handlers/monitoring/__init__.py b/src/aipass/prax/apps/handlers/monitoring/__init__.py index c93aea37..db3732a3 100644 --- a/src/aipass/prax/apps/handlers/monitoring/__init__.py +++ b/src/aipass/prax/apps/handlers/monitoring/__init__.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 """ Monitoring Handlers Package diff --git a/src/aipass/prax/apps/handlers/monitoring/branch_detector.py b/src/aipass/prax/apps/handlers/monitoring/branch_detector.py index 95fcc445..b0187b7b 100644 --- a/src/aipass/prax/apps/handlers/monitoring/branch_detector.py +++ b/src/aipass/prax/apps/handlers/monitoring/branch_detector.py @@ -1,11 +1,10 @@ -#!/home/aipass/.venv/bin/python3 # META DATA HEADER # Name: branch_detector.py - Branch Attribution Handler # Version: 0.1.0 # Purpose: Detect which branch owns a file/log/module # Created: 2025-11-23 -# Location: /home/aipass/aipass_core/prax/apps/handlers/monitoring/branch_detector.py +# Location: src/aipass/prax/apps/handlers/monitoring/branch_detector.py """ Branch Detection Handler @@ -44,8 +43,21 @@ class BranchDetector: self.log_map: Dict[str, str] = {} # log file -> branch self.module_map: Dict[str, str] = {} # module -> branch self.known_branches: Set[str] = set() + self._repo_root: Optional[Path] = None self._load_registry() + def _find_repo_root(self) -> Path: + """Walk up from this file to find repo root (contains AIPASS_REGISTRY.json).""" + if self._repo_root is not None: + return self._repo_root + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + self._repo_root = parent + return parent + self._repo_root = Path.cwd() + return self._repo_root + def _load_registry(self): """ Load BRANCH_REGISTRY.json and build lookup tables. @@ -55,7 +67,7 @@ class BranchDetector: - known_branches: Set of all branch names for pattern matching """ try: - registry_path = Path.home() / "BRANCH_REGISTRY.json" + registry_path = self._find_repo_root() / "AIPASS_REGISTRY.json" if not registry_path.exists(): logger.warning(f"Registry not found: {registry_path}") @@ -148,11 +160,11 @@ class BranchDetector: remaining = path_str[projects_idx:] # Get the project folder name (first path segment after projects/) project_folder = remaining.split('/')[0] - # Convert folder name back to path: -home-aipass-aipass-core-trigger -> /home/aipass/aipass_core/trigger + # Convert folder name back to path: -home-user-src-aipass-trigger -> /home/user/src/aipass/trigger project_path = '/' + project_folder.replace('-', '/') # Check against branch_map (registered branch paths) for registered_path, branch_name in self.branch_map.items(): - # Normalize for comparison: aipass_core vs aipass-core + # Normalize for comparison: underscores vs hyphens registered_normalized = registered_path.replace('_', '/') project_normalized = project_path.replace('_', '/') if registered_normalized == project_normalized or registered_path == project_path: @@ -174,7 +186,7 @@ class BranchDetector: return last # Strategy 4: AI_CENTRAL files - {BRANCH}.central.json or {BRANCH}_central.json - # Path: /home/aipass/aipass_os/AI_CENTRAL/AI_MAIL.central.json -> AI_MAIL + # Path: .../AI_CENTRAL/AI_MAIL.central.json -> AI_MAIL if 'AI_CENTRAL' in path_str or 'ai_central' in path_str.lower(): name = path.name # Extract branch from filename patterns @@ -187,9 +199,9 @@ class BranchDetector: self.log_map[path_str] = branch_candidate return branch_candidate - # Strategy 5: Root-level system files - home = str(Path.home()) - if path.parent == Path(home) or path.parent == Path(home) / '.claude': + # Strategy 5: Root-level system files (repo root or .claude under it) + repo_root = self._find_repo_root() + if path.parent == repo_root or path.parent == repo_root / '.claude': self.log_map[path_str] = 'SYSTEM' return 'SYSTEM' @@ -201,7 +213,7 @@ class BranchDetector: self.log_map[path_str] = branch_upper return branch_upper - # Strategy 6: Check for compound names (aipass_core -> check for CORE patterns) + # Strategy 6: Check for compound names (e.g., ai_mail -> check for AI_MAIL patterns) for part in path_parts: if '_' in part: subparts = part.split('_') @@ -281,7 +293,7 @@ class BranchDetector: Detect branch from Python module name. Supports patterns: - - prax.apps.handlers.monitoring -> PRAX + - aipass.prax.apps.handlers.monitoring -> PRAX - seed.core.validator -> SEED Args: @@ -414,9 +426,9 @@ if __name__ == '__main__': print("=" * 50) test_paths = [ - "/home/aipass/aipass_core/prax/apps/handlers/monitoring/branch_detector.py", - "/home/aipass/aipass_core/seed/core/validator.py", - "/home/aipass/aipass_os/dev_central/flow/planners/", + "src/aipass/prax/apps/handlers/monitoring/branch_detector.py", + "src/aipass/seedgo/core/validator.py", + "src/aipass/flow/apps/modules/planners.py", ] print("\nPath Detection:") @@ -437,7 +449,7 @@ if __name__ == '__main__': print(f" {log} -> {branch}") test_modules = [ - "prax.apps.handlers.monitoring", + "aipass.prax.apps.handlers.monitoring", "seed.core.validator", "flow.planners.daily", ] diff --git a/src/aipass/prax/apps/handlers/monitoring/event_queue.py b/src/aipass/prax/apps/handlers/monitoring/event_queue.py index 9c7bc781..cdd2f78c 100644 --- a/src/aipass/prax/apps/handlers/monitoring/event_queue.py +++ b/src/aipass/prax/apps/handlers/monitoring/event_queue.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/prax/apps/handlers/monitoring/file_watcher_integration.py b/src/aipass/prax/apps/handlers/monitoring/file_watcher_integration.py index bb8f6c25..74e4b0d0 100644 --- a/src/aipass/prax/apps/handlers/monitoring/file_watcher_integration.py +++ b/src/aipass/prax/apps/handlers/monitoring/file_watcher_integration.py @@ -1,11 +1,10 @@ -#!/home/aipass/.venv/bin/python3 # META DATA HEADER # Name: file_watcher_integration.py - File Watcher Integration # Version: 0.1.0 # Purpose: Connect file watcher to monitoring event queue # Created: 2025-11-23 -# Location: /home/aipass/aipass_core/prax/apps/handlers/monitoring/file_watcher_integration.py +# Location: src/aipass/prax/apps/handlers/monitoring/file_watcher_integration.py """ File Watcher Integration Handler @@ -86,7 +85,8 @@ def load_branch_paths(branch_filter: Optional[List[str]] = None) -> List[Tuple[s Empty list if registry not found or error """ try: - registry_path = Path.home() / "BRANCH_REGISTRY.json" + from aipass.prax.apps.handlers.config.load import _find_repo_root + registry_path = _find_repo_root() / "AIPASS_REGISTRY.json" if not registry_path.exists(): logger.warning(f"BRANCH_REGISTRY.json not found at {registry_path}") diff --git a/src/aipass/prax/apps/handlers/monitoring/interactive_filter.py b/src/aipass/prax/apps/handlers/monitoring/interactive_filter.py index 60f6a986..daaa8e82 100644 --- a/src/aipass/prax/apps/handlers/monitoring/interactive_filter.py +++ b/src/aipass/prax/apps/handlers/monitoring/interactive_filter.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # META DATA HEADER # Name: interactive_filter.py - Command Parser and Filter State diff --git a/src/aipass/prax/apps/handlers/monitoring/log_watcher.py b/src/aipass/prax/apps/handlers/monitoring/log_watcher.py index 536feded..637303d0 100644 --- a/src/aipass/prax/apps/handlers/monitoring/log_watcher.py +++ b/src/aipass/prax/apps/handlers/monitoring/log_watcher.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -42,7 +41,7 @@ from watchdog.observers import Observer as WatchdogObserver from watchdog.events import FileSystemEventHandler # Import from prax config -from aipass.prax.apps.handlers.config.load import SYSTEM_LOGS_DIR +from aipass.prax.apps.handlers.config.load import get_system_logs_dir # Import monitoring infrastructure from aipass.prax.apps.handlers.monitoring.event_queue import MonitoringEvent, MonitoringQueue @@ -125,7 +124,7 @@ class LogFileWatcher(FileSystemEventHandler): return # Only watch files in system_logs directory - if str(SYSTEM_LOGS_DIR) not in file_path: + if str(get_system_logs_dir()) not in file_path: return try: @@ -320,22 +319,22 @@ class LogFileWatcher(FileSystemEventHandler): if cmd_match: cmd = cmd_match.group(1).strip() # Extract target from command (e.g., "seed.py audit @prax" -> PRAX) - # Or "seed.py audit /home/aipass/aipass_core/prax" -> PRAX + # Or "seed.py audit /path/to/src/aipass/prax" -> PRAX target = None target_match = re.search(r'@(\w+)', cmd) if target_match: target = target_match.group(1).upper() else: - # Check for full path target - path_match = re.search(r'/home/aipass/(?:aipass_core|aipass_os)/(\w+)', cmd) + # Check for full path target (src/aipass/{module} structure) + path_match = re.search(r'/aipass/(\w+)', cmd) if path_match: target = path_match.group(1).upper() # Clean up command display - simplify paths display_cmd = cmd # Replace full paths with @branch notation - display_cmd = re.sub(r'/home/aipass/aipass_core/(\w+)/apps/\w+\.py', lambda m: f"@{m.group(1)}", display_cmd) - display_cmd = re.sub(r'/home/aipass/aipass_core/(\w+)', lambda m: f"@{m.group(1)}", display_cmd) + display_cmd = re.sub(r'[^\s]*/aipass/(\w+)/apps/\w+\.py', lambda m: f"@{m.group(1)}", display_cmd) + display_cmd = re.sub(r'[^\s]*/aipass/(\w+)', lambda m: f"@{m.group(1)}", display_cmd) return {'command': display_cmd, 'caller': caller, 'target': target} @@ -466,11 +465,11 @@ class LogFileWatcher(FileSystemEventHandler): Only show NEW entries after watcher starts. Copied from discovery/watcher.py start_file_watcher() """ - if not SYSTEM_LOGS_DIR.exists(): - logger.warning(f"System logs directory not found: {SYSTEM_LOGS_DIR}") + if not get_system_logs_dir().exists(): + logger.warning(f"System logs directory not found: {get_system_logs_dir()}") return - for log_file in SYSTEM_LOGS_DIR.glob("*.log"): + for log_file in get_system_logs_dir().glob("*.log"): try: self.log_positions[str(log_file)] = log_file.stat().st_size except Exception as e: @@ -502,12 +501,12 @@ def start_log_watcher(event_queue: MonitoringQueue) -> Any: # Create and start observer observer = WatchdogObserver() - observer.schedule(watcher, str(SYSTEM_LOGS_DIR), recursive=False) + observer.schedule(watcher, str(get_system_logs_dir()), recursive=False) observer.start() _log_observer = observer - logger.info(f"Log watcher started, monitoring: {SYSTEM_LOGS_DIR}") + logger.info(f"Log watcher started, monitoring: {get_system_logs_dir()}") return observer @@ -554,7 +553,7 @@ if __name__ == '__main__': console.print("[bold cyan]PRAX Log Watcher Test[/bold cyan]") console.print() - console.print(f"Monitoring: {SYSTEM_LOGS_DIR}") + console.print(f"Monitoring: {get_system_logs_dir()}") console.print("Press Ctrl+C to stop") console.print() diff --git a/src/aipass/prax/apps/handlers/monitoring/module_tracker.py b/src/aipass/prax/apps/handlers/monitoring/module_tracker.py index 9c28e84f..730fdd55 100644 --- a/src/aipass/prax/apps/handlers/monitoring/module_tracker.py +++ b/src/aipass/prax/apps/handlers/monitoring/module_tracker.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # META DATA HEADER # Name: module_tracker.py - Module Execution Tracker diff --git a/src/aipass/prax/apps/handlers/monitoring/monitoring_filters.py b/src/aipass/prax/apps/handlers/monitoring/monitoring_filters.py index f611c370..9721eaab 100644 --- a/src/aipass/prax/apps/handlers/monitoring/monitoring_filters.py +++ b/src/aipass/prax/apps/handlers/monitoring/monitoring_filters.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/prax/apps/handlers/monitoring/telegram_command_bot.py b/src/aipass/prax/apps/handlers/monitoring/telegram_command_bot.py index 2b83bddf..1483dc91 100644 --- a/src/aipass/prax/apps/handlers/monitoring/telegram_command_bot.py +++ b/src/aipass/prax/apps/handlers/monitoring/telegram_command_bot.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -65,11 +64,34 @@ logger = get_direct_logger() # CONSTANTS # ============================================= -AIPASS_HOME = Path.home() -CONFIG_PATH = AIPASS_HOME / ".aipass" / "scheduler_config.json" -DAEMON_LOG = AIPASS_HOME / "aipass_core" / "ai_mail" / "ai_mail.local" / "dispatch_daemon.log" -VERA_NOTEPAD = AIPASS_HOME / "aipass_business" / "vera" / "NOTEPAD.md" -MONITOR_PID_FILE = AIPASS_HOME / ".aipass" / "prax_monitor.pid" +def _find_repo_root() -> Path: + """Walk up from this file to find the repo root (contains AIPASS_REGISTRY.json).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + +_repo_root_cache: Path | None = None + +def _get_repo_root() -> Path: + """Lazily resolve repo root.""" + global _repo_root_cache + if _repo_root_cache is None: + _repo_root_cache = _find_repo_root() + return _repo_root_cache + +def _get_config_path() -> Path: + return _get_repo_root() / ".aipass" / "scheduler_config.json" + +def _get_daemon_log() -> Path: + return _get_repo_root() / "src" / "aipass" / "ai_mail" / "ai_mail.local" / "dispatch_daemon.log" + +def _get_vera_notepad() -> Path: + return _get_repo_root() / "src" / "aipass" / "vera" / "NOTEPAD.md" + +def _get_monitor_pid_file() -> Path: + return _get_repo_root() / ".aipass" / "prax_monitor.pid" POLL_INTERVAL = 10 # seconds TELEGRAM_MAX_LENGTH = 4000 PATRICK_CHAT_ID = "7235222625" @@ -93,7 +115,7 @@ _last_log_pos = 0 def _load_config(): """Load scheduler bot config.""" try: - with open(CONFIG_PATH, "r", encoding="utf-8") as f: + with open(_get_config_path(), "r", encoding="utf-8") as f: return json.load(f) except (FileNotFoundError, json.JSONDecodeError): logger.warning("Config not found") @@ -156,17 +178,17 @@ def _monitor_daemon_log(): _send_message("🟢 Prax Monitor ON\nWatching daemon log for events.", config) try: - if DAEMON_LOG.exists(): - _last_log_pos = DAEMON_LOG.stat().st_size + if _get_daemon_log().exists(): + _last_log_pos = _get_daemon_log().stat().st_size except OSError: _last_log_pos = 0 while _monitoring_active: try: - if DAEMON_LOG.exists(): - current_size = DAEMON_LOG.stat().st_size + if _get_daemon_log().exists(): + current_size = _get_daemon_log().stat().st_size if current_size > _last_log_pos: - with open(DAEMON_LOG, "r", encoding="utf-8") as f: + with open(_get_daemon_log(), "r", encoding="utf-8") as f: f.seek(_last_log_pos) new_lines = f.readlines() _last_log_pos = current_size @@ -201,7 +223,7 @@ def _start_monitoring(): # Write PID file try: - MONITOR_PID_FILE.write_text(str(os.getpid())) + _get_monitor_pid_file().write_text(str(os.getpid())) except OSError: pass @@ -221,7 +243,7 @@ def _stop_monitoring(): # Remove PID file try: - MONITOR_PID_FILE.unlink(missing_ok=True) + _get_monitor_pid_file().unlink(missing_ok=True) except OSError: pass @@ -253,7 +275,7 @@ def _cmd_status(): # VERA check - last NOTEPAD entry try: - with open(VERA_NOTEPAD, "r", encoding="utf-8") as f: + with open(_get_vera_notepad(), "r", encoding="utf-8") as f: content = f.read() # Find first "What Just Happened" line for line in content.split("\n"): @@ -380,7 +402,7 @@ def main(): # Cleanup _stop_monitoring() - MONITOR_PID_FILE.unlink(missing_ok=True) + _get_monitor_pid_file().unlink(missing_ok=True) logger.info("Prax Command Bot stopped.") diff --git a/src/aipass/prax/apps/handlers/monitoring/telegram_relay.py b/src/aipass/prax/apps/handlers/monitoring/telegram_relay.py index 0dac85cd..ad09697c 100644 --- a/src/aipass/prax/apps/handlers/monitoring/telegram_relay.py +++ b/src/aipass/prax/apps/handlers/monitoring/telegram_relay.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -57,7 +56,17 @@ from urllib.error import URLError # CONSTANTS # ============================================= -PRAX_MONITOR_CONFIG = Path.home() / ".aipass" / "prax_monitor_config.json" +def _find_repo_root() -> Path: + """Walk up from this file to find the repo root (contains AIPASS_REGISTRY.json).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + +def _get_prax_monitor_config() -> Path: + """Lazily resolve prax monitor config path.""" + return _find_repo_root() / ".aipass" / "prax_monitor_config.json" BATCH_INTERVAL = 5.0 # Seconds between flushes TELEGRAM_MAX_LENGTH = 4000 # Leave margin under 4096 limit @@ -173,7 +182,7 @@ def _flush(): def _send_telegram(message): """Send a message to Telegram via the Prax Monitor bot. Silent failure.""" try: - with open(PRAX_MONITOR_CONFIG, "r", encoding="utf-8") as f: + with open(_get_prax_monitor_config(), "r", encoding="utf-8") as f: config = json.load(f) bot_token = config["telegram_bot_token"] chat_id = config["telegram_chat_id"] diff --git a/src/aipass/prax/apps/handlers/monitoring/unified_stream.py b/src/aipass/prax/apps/handlers/monitoring/unified_stream.py index 5774d2c3..c7338dd7 100644 --- a/src/aipass/prax/apps/handlers/monitoring/unified_stream.py +++ b/src/aipass/prax/apps/handlers/monitoring/unified_stream.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/prax/apps/handlers/registry/ignore.py b/src/aipass/prax/apps/handlers/registry/ignore.py index 9b0d8287..0be62513 100755 --- a/src/aipass/prax/apps/handlers/registry/ignore.py +++ b/src/aipass/prax/apps/handlers/registry/ignore.py @@ -1,5 +1,3 @@ -#!/home/aipass/.venv/bin/python3 -# -*- coding: utf-8 -*- # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/prax/apps/handlers/registry/load.py b/src/aipass/prax/apps/handlers/registry/load.py index b9b77fe6..0246ccf6 100755 --- a/src/aipass/prax/apps/handlers/registry/load.py +++ b/src/aipass/prax/apps/handlers/registry/load.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/prax/apps/handlers/registry/meta_ops.py b/src/aipass/prax/apps/handlers/registry/meta_ops.py index 578f8a7f..2015d3bf 100755 --- a/src/aipass/prax/apps/handlers/registry/meta_ops.py +++ b/src/aipass/prax/apps/handlers/registry/meta_ops.py @@ -1,5 +1,3 @@ -#!/home/aipass/.venv/bin/python3 -# -*- coding: utf-8 -*- # ===================AIPASS==================== # META DATA HEADER @@ -32,7 +30,17 @@ from typing import Dict, Optional # CONSTANTS # ============================================================================= -TEMPLATE_DIR = Path.home() / "aipass_core" / "cortex" / "templates" / "branch_ template" +def _find_repo_root() -> Path: + """Walk up from this file to find repo root (contains AIPASS_REGISTRY.json).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + +def _get_template_dir() -> Path: + """Lazily resolve template directory (package-relative).""" + return _find_repo_root() / "src" / "aipass" / "cortex" / "templates" / "branch_template" # Files that get renamed during branch creation FILE_RENAMES = { @@ -85,7 +93,7 @@ def load_template_registry() -> Optional[Dict]: Returns: Template registry dict or None if not found/error """ - registry_path = TEMPLATE_DIR / "template_registry.json" + registry_path = _get_template_dir() / "template_registry.json" if not registry_path.exists(): return None diff --git a/src/aipass/prax/apps/handlers/registry/reader.py b/src/aipass/prax/apps/handlers/registry/reader.py index 24e6f123..f29bbb9a 100755 --- a/src/aipass/prax/apps/handlers/registry/reader.py +++ b/src/aipass/prax/apps/handlers/registry/reader.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -31,7 +30,22 @@ from typing import List, Dict, Any # CONSTANTS # ============================================================================= -BRANCH_REGISTRY_PATH = Path.home() / "BRANCH_REGISTRY.json" +def _find_repo_root() -> Path: + """Walk up from this file to find the repo root (contains AIPASS_REGISTRY.json).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + +_branch_registry_path_cache: Path | None = None + +def _get_branch_registry_path() -> Path: + """Lazily resolve AIPASS_REGISTRY.json path.""" + global _branch_registry_path_cache + if _branch_registry_path_cache is None: + _branch_registry_path_cache = _find_repo_root() / "AIPASS_REGISTRY.json" + return _branch_registry_path_cache # ============================================================================= # CORE FUNCTIONS @@ -45,10 +59,10 @@ def read_registry() -> List[Dict[str, Any]] | None: List of branch dictionaries, or None on error """ try: - if not BRANCH_REGISTRY_PATH.exists(): + if not _get_branch_registry_path().exists(): return None - with open(BRANCH_REGISTRY_PATH, 'r', encoding='utf-8') as f: + with open(_get_branch_registry_path(), 'r', encoding='utf-8') as f: data = json.load(f) branches = data.get('branches', []) diff --git a/src/aipass/prax/apps/handlers/registry/save.py b/src/aipass/prax/apps/handlers/registry/save.py index afdf00f7..525b0225 100755 --- a/src/aipass/prax/apps/handlers/registry/save.py +++ b/src/aipass/prax/apps/handlers/registry/save.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -67,7 +66,7 @@ def save_module_registry(modules: Dict[str, Dict[str, Any]]) -> bool: "statistics": { "total_modules": 42, "last_updated": "2025-11-07T...", - "scan_location": "/home/aipass/aipass_core" + "scan_location": "src/aipass" } } diff --git a/src/aipass/prax/apps/handlers/registry/statistics.py b/src/aipass/prax/apps/handlers/registry/statistics.py index d12e9118..5197c0ae 100755 --- a/src/aipass/prax/apps/handlers/registry/statistics.py +++ b/src/aipass/prax/apps/handlers/registry/statistics.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -57,7 +56,7 @@ def get_registry_statistics() -> Dict[str, Any]: "total_modules": 42, "registry_exists": True, "last_updated": "2025-11-07T...", - "scan_location": "/home/aipass/aipass_core" + "scan_location": "src/aipass" } If registry doesn't exist or error occurs: diff --git a/src/aipass/prax/apps/handlers/watcher/monitor.py b/src/aipass/prax/apps/handlers/watcher/monitor.py index daf0dd0e..05245334 100755 --- a/src/aipass/prax/apps/handlers/watcher/monitor.py +++ b/src/aipass/prax/apps/handlers/watcher/monitor.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/prax/apps/handlers/watcher/reporter.py b/src/aipass/prax/apps/handlers/watcher/reporter.py index a97d038b..ee689b82 100755 --- a/src/aipass/prax/apps/handlers/watcher/reporter.py +++ b/src/aipass/prax/apps/handlers/watcher/reporter.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -67,7 +66,7 @@ def format_change(branch_name: str, action: str, file_path: str) -> str: path_obj = Path(file_path) relative_path = file_path for part in path_obj.parts: - if part in ['aipass_core', 'aipass']: + if part == 'aipass': idx = path_obj.parts.index(part) if idx + 1 < len(path_obj.parts): relative_path = str(Path(*path_obj.parts[idx+1:])) diff --git a/src/aipass/prax/apps/modules/__init__.py b/src/aipass/prax/apps/modules/__init__.py index 3709d413..57f21c71 100755 --- a/src/aipass/prax/apps/modules/__init__.py +++ b/src/aipass/prax/apps/modules/__init__.py @@ -13,5 +13,5 @@ Available modules: system_logger.warning("Warning message") system_logger.error("Error message") - Logs auto-route to: /home/aipass/system_logs/.log + Logs auto-route to: {repo_root}/system_logs/.log """ diff --git a/src/aipass/prax/apps/modules/agent_status_module.py b/src/aipass/prax/apps/modules/agent_status_module.py index e73fc3fe..02bab233 100644 --- a/src/aipass/prax/apps/modules/agent_status_module.py +++ b/src/aipass/prax/apps/modules/agent_status_module.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/prax/apps/modules/discover_module.py b/src/aipass/prax/apps/modules/discover_module.py index 84bde1a5..24b9a9bb 100755 --- a/src/aipass/prax/apps/modules/discover_module.py +++ b/src/aipass/prax/apps/modules/discover_module.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/prax/apps/modules/init_module.py b/src/aipass/prax/apps/modules/init_module.py index cbc74908..91a5b057 100755 --- a/src/aipass/prax/apps/modules/init_module.py +++ b/src/aipass/prax/apps/modules/init_module.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/prax/apps/modules/log_audit_module.py b/src/aipass/prax/apps/modules/log_audit_module.py index 733e8052..9324e0bb 100644 --- a/src/aipass/prax/apps/modules/log_audit_module.py +++ b/src/aipass/prax/apps/modules/log_audit_module.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -20,7 +19,7 @@ PRAX Log Audit Module Implements the 'log-audit' command for system log health monitoring. -Scans /home/aipass/system_logs/ for oversized files, reports status, +Scans the system_logs/ directory for oversized files, reports status, and optionally enforces size limits by truncating bloated logs. """ diff --git a/src/aipass/prax/apps/modules/logger.py b/src/aipass/prax/apps/modules/logger.py index 262c4428..18afa657 100755 --- a/src/aipass/prax/apps/modules/logger.py +++ b/src/aipass/prax/apps/modules/logger.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -66,7 +65,7 @@ from aipass.prax.apps.handlers.discovery.watcher import ( ) from aipass.prax.apps.handlers.registry.save import save_module_registry from aipass.prax.apps.handlers.registry.load import load_module_registry -from aipass.prax.apps.handlers.config.load import SYSTEM_LOGS_DIR, PRAX_JSON_DIR +from aipass.prax.apps.handlers.config.load import get_system_logs_dir, PRAX_JSON_DIR from aipass.prax.apps.handlers.logging.direct import ( get_direct_logger, direct_log, @@ -163,7 +162,7 @@ def initialize_logging_system(): # Log system startup system_logger_instance.info("Prax logging system initialized") - system_logger_instance.info(f"System logs directory: {SYSTEM_LOGS_DIR}") + system_logger_instance.info(f"System logs directory: {get_system_logs_dir()}") system_logger_instance.info(f"Found {len(modules)} modules for logging setup") # Install logger override @@ -253,7 +252,7 @@ def get_system_status() -> Dict[str, Any]: return { "total_modules": len(modules), "individual_loggers": get_captured_loggers_count(), - "system_logs_dir": str(SYSTEM_LOGS_DIR), + "system_logs_dir": str(get_system_logs_dir()), "registry_file": str(DATA_FILE), "file_watcher_active": is_file_watcher_active(), "logger_override_active": is_override_active() diff --git a/src/aipass/prax/apps/modules/monitor_module.py b/src/aipass/prax/apps/modules/monitor_module.py index 00c1b3a7..2ad5a853 100755 --- a/src/aipass/prax/apps/modules/monitor_module.py +++ b/src/aipass/prax/apps/modules/monitor_module.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -110,8 +109,11 @@ def normalize_branch_arg(arg: str) -> str: DRONE now resolves @branch arguments to full paths before passing to modules. This function normalizes both formats to branch names. + The package structure is: .../src/aipass/{module}/apps/... + Find "aipass" in path parts, then the next part is the module name. + Args: - arg: Branch name (e.g., "flow") or full path (e.g., "/home/aipass/aipass_core/flow") + arg: Branch name (e.g., "flow") or full path (e.g., ".../src/aipass/flow") Returns: Uppercase branch name (e.g., "FLOW") @@ -119,17 +121,15 @@ def normalize_branch_arg(arg: str) -> str: Examples: >>> normalize_branch_arg("flow") "FLOW" - >>> normalize_branch_arg("/home/aipass/aipass_core/flow") + >>> normalize_branch_arg("/path/to/src/aipass/flow") "FLOW" - >>> normalize_branch_arg("/home/aipass/seed") - "SEED" """ if arg.startswith('/'): from pathlib import Path parts = Path(arg).parts - # Check if path contains aipass_core - extract branch name after it - if 'aipass_core' in parts: - idx = parts.index('aipass_core') + # Check if path contains "aipass" - extract module name after it + if 'aipass' in parts: + idx = parts.index('aipass') if idx + 1 < len(parts): return parts[idx + 1].upper() # Otherwise, use last part of path @@ -158,7 +158,8 @@ def _refresh_pid_cache() -> None: _pid_cache_last_refresh = now try: - registry_path = Path.home() / "BRANCH_REGISTRY.json" + from aipass.prax.apps.handlers.config.load import _find_repo_root + registry_path = _find_repo_root() / "AIPASS_REGISTRY.json" if not registry_path.exists(): return data = _json.loads(registry_path.read_text(encoding="utf-8")) @@ -591,11 +592,12 @@ def _file_watcher_worker(): logger.error(f"[monitor] Error handling {action} event for {path_str}: {e}") # Create observer and start watching - # Watch entire /home/aipass directory (covers aipass_core, aipass_os, speakeasy, etc.) + # Watch from repo root (covers all modules) + from aipass.prax.apps.handlers.config.load import _find_repo_root observer = Observer() handler = MonitoringFileHandler() - home_dir = Path.home() - observer.schedule(handler, str(home_dir), recursive=True) + watch_dir = _find_repo_root() + observer.schedule(handler, str(watch_dir), recursive=True) observer.start() try: diff --git a/src/aipass/prax/apps/modules/run_module.py b/src/aipass/prax/apps/modules/run_module.py index 6685c7ff..af377d72 100755 --- a/src/aipass/prax/apps/modules/run_module.py +++ b/src/aipass/prax/apps/modules/run_module.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/prax/apps/modules/shutdown_module.py b/src/aipass/prax/apps/modules/shutdown_module.py index 60ac9ff4..cd39b415 100755 --- a/src/aipass/prax/apps/modules/shutdown_module.py +++ b/src/aipass/prax/apps/modules/shutdown_module.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/prax/apps/modules/status_module.py b/src/aipass/prax/apps/modules/status_module.py index 95e0ccbd..65ce95b3 100755 --- a/src/aipass/prax/apps/modules/status_module.py +++ b/src/aipass/prax/apps/modules/status_module.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/prax/apps/modules/terminal_module.py b/src/aipass/prax/apps/modules/terminal_module.py index 558ff21f..ba2ba3b5 100755 --- a/src/aipass/prax/apps/modules/terminal_module.py +++ b/src/aipass/prax/apps/modules/terminal_module.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/prax/apps/prax.py b/src/aipass/prax/apps/prax.py index 322b916d..b80d5f1e 100755 --- a/src/aipass/prax/apps/prax.py +++ b/src/aipass/prax/apps/prax.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -66,7 +65,7 @@ def discover_command_modules() -> List[Callable]: try: # Import module dynamically - module_name = f"prax.apps.modules.{module_file.stem}" + module_name = f"aipass.prax.apps.modules.{module_file.stem}" module = importlib.import_module(module_name) # Check for handle_command interface diff --git a/src/aipass/prax/tests/conftest.py b/src/aipass/prax/tests/conftest.py index a87088fd..3cccc54b 100644 --- a/src/aipass/prax/tests/conftest.py +++ b/src/aipass/prax/tests/conftest.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/seedgo/apps/seedgo.py b/src/aipass/seedgo/apps/seedgo.py index 34b5f208..85473395 100644 --- a/src/aipass/seedgo/apps/seedgo.py +++ b/src/aipass/seedgo/apps/seedgo.py @@ -131,12 +131,6 @@ def route_to_pack(pack_name: str, command: str, args: List[str]) -> bool: return False pack_module = importlib.util.module_from_spec(spec) - # Add pack root to sys.path so pack modules can find their handlers - # The pack dir contains 'aipass_json/' etc but NOT an 'aipass/' dir that would shadow the package - pack_root_str = str(pack_path) - if pack_root_str not in sys.path: - sys.path.insert(0, pack_root_str) - spec.loader.exec_module(pack_module) if hasattr(pack_module, "main"): diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/audit/branch_audit.py b/src/aipass/seedgo/apps/standards/aipass/handlers/audit/branch_audit.py index 02f4a137..762a17a8 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/audit/branch_audit.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/audit/branch_audit.py @@ -24,27 +24,28 @@ from typing import Dict # IMPORTS # ============================================================================= -from ..standards import imports_check -from ..standards import architecture_check -from ..standards import naming_check -from ..standards import cli_check -from ..standards import handlers_check -from ..standards import modules_check -from ..standards import documentation_check -from ..standards import json_structure_check -from ..standards import testing_check -from ..standards import error_handling_check -from ..standards import encapsulation_check -from ..standards import trigger_check -from ..standards import log_level_check -from ..standards import cli_flags_check -from ..standards import log_handler_check -from ..standards import log_visibility_check -from ..standards import permission_flags_check -from ..standards import readme_check -from ..standards import diagnostics_check -from ..standards import meta_check -from ..config import ignore_handler +from aipass.seedgo.apps.standards.aipass.handlers.standards import imports_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import architecture_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import naming_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import cli_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import handlers_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import modules_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import documentation_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import json_structure_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import testing_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import error_handling_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import encapsulation_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import trigger_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import log_level_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import cli_flags_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import log_handler_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import log_visibility_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import permission_flags_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import readme_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import diagnostics_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import meta_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import shebang_check +from aipass.seedgo.apps.standards.aipass.handlers.config import ignore_handler # ============================================================================= @@ -106,7 +107,8 @@ def audit_branch(branch: Dict[str, str], bypass_rules: list) -> Dict: 'log_visibility': log_visibility_check, 'permission_flags': permission_flags_check, 'readme': readme_check, - 'meta': meta_check + 'meta': meta_check, + 'shebang': shebang_check } results = {} @@ -414,6 +416,33 @@ def audit_branch(branch: Dict[str, str], bypass_rules: list) -> Dict: scores['permission_flags'] = int(sum(permission_flags_scores) / len(permission_flags_scores)) avg_score = int(sum(scores.values()) / len(scores)) if scores else 0 + # Check SHEBANG on ALL files (no #!/... in pip packages) + shebang_violations = [] + shebang_scores = [] + if all_file_results: + for file_info in all_file_results: + try: + sb_result = shebang_check.check_module(file_info['file'], bypass_rules=bypass_rules) + sb_score = sb_result.get('score', 0) + if sb_result.get('checks', []): + shebang_scores.append(sb_score) + if not sb_result.get('passed', True): + failed_checks = [c for c in sb_result.get('checks', []) if not c.get('passed', False)] + if failed_checks: + shebang_violations.append({ + 'file': file_info['name'], + 'path': file_info['file'], + 'score': sb_score, + 'issues': [c.get('message', 'Unknown') for c in failed_checks] + }) + except Exception: + pass + + # Update shebang score to reflect ALL files + if shebang_scores: + scores['shebang'] = int(sum(shebang_scores) / len(shebang_scores)) + avg_score = int(sum(scores.values()) / len(scores)) if scores else 0 + # Run TYPE ERROR diagnostics on the branch (pyright) diagnostics_result = diagnostics_check.check_branch(str(branch_path)) type_errors = diagnostics_result.get('total_errors', 0) @@ -451,6 +480,7 @@ def audit_branch(branch: Dict[str, str], bypass_rules: list) -> Dict: 'permission_flags_violations': permission_flags_violations, 'cli_flags_violations': [], 'json_structure_violations': json_structure_violations, + 'shebang_violations': shebang_violations, 'deprecated_patterns': deprecated_patterns, 'files_checked': len(all_file_results), 'type_errors': type_errors, diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/audit/bypass_audit.py b/src/aipass/seedgo/apps/standards/aipass/handlers/audit/bypass_audit.py index 135003d0..2d3e4811 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/audit/bypass_audit.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/audit/bypass_audit.py @@ -24,18 +24,18 @@ from typing import List, Dict # IMPORTS # ============================================================================= -from ..standards import imports_check -from ..standards import architecture_check -from ..standards import naming_check -from ..standards import cli_check -from ..standards import handlers_check -from ..standards import modules_check -from ..standards import documentation_check -from ..standards import json_structure_check -from ..standards import testing_check -from ..standards import error_handling_check -from ..standards import encapsulation_check -from ..standards import meta_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import imports_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import architecture_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import naming_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import cli_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import handlers_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import modules_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import documentation_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import json_structure_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import testing_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import error_handling_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import encapsulation_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import meta_check # ============================================================================= diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/config/__init__.py b/src/aipass/seedgo/apps/standards/aipass/handlers/config/__init__.py index 176ee3e5..51eee14f 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/config/__init__.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/config/__init__.py @@ -1,24 +1,5 @@ -#!/home/aipass/.venv/bin/python3 - -# ===================AIPASS==================== -# META DATA HEADER -# Name: __init__.py - Config handlers package -# Date: 2025-11-25 -# Version: 1.0.0 -# Category: handlers -# -# CHANGELOG (Max 5 entries): -# - v1.0.0 (2025-11-25): Initial creation -# * Config handlers package initialization -# -# CODE STANDARDS: -# - Follow seed 3-layer architecture -# - Handlers must be independent and transportable -# - No cross-handler imports except within same domain -# ============================================= - """ Config Handlers Package -Contains configuration handlers for the Seed branch. +Contains configuration handlers for the Seedgo branch. """ diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/diagnostics/runner.py b/src/aipass/seedgo/apps/standards/aipass/handlers/diagnostics/runner.py index 75787b99..329d5eff 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/diagnostics/runner.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/diagnostics/runner.py @@ -28,7 +28,7 @@ def run_branch_diagnostics(branch: Dict) -> Dict: Dict with diagnostics results """ # Import diagnostics checker - from seed.apps.handlers.standards.diagnostics_check import check_branch + from aipass.seedgo.apps.standards.aipass.handlers.standards.diagnostics_check import check_branch branch_name = branch.get('name', 'UNKNOWN') branch_path = branch.get('path', '') diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/json/json_handler.py b/src/aipass/seedgo/apps/standards/aipass/handlers/json/json_handler.py index e89d5df4..9ab7dccd 100755 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/json/json_handler.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/json/json_handler.py @@ -246,7 +246,7 @@ if __name__ == "__main__": update_data_metrics("seed", test_metric="working") console.print() - console.print("[green]Check /home/aipass/seed/seed_json/ for created files:[/green]") + console.print("[green]Check aipass_json/ directory for created files:[/green]") console.print(" [dim]•[/dim] seed_config.json") console.print(" [dim]•[/dim] seed_data.json") console.print(" [dim]•[/dim] seed_log.json") diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/architecture_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/architecture_check.py index 3c5ef967..55dff6ac 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/architecture_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/architecture_check.py @@ -20,7 +20,7 @@ import json from pathlib import Path from typing import Dict, List, Optional -from ..config.ignore_handler import get_template_ignore_patterns +from aipass.seedgo.apps.standards.aipass.handlers.config.ignore_handler import get_template_ignore_patterns PACK_ROOT = Path(__file__).resolve().parent.parent.parent # standards/ -> handlers/ -> aipass/ @@ -311,7 +311,7 @@ def check_domain_organization(module_path: str) -> Optional[Dict]: Bad: handlers/utils/, handlers/helpers/, handlers/operations/ """ # Extract handler domain from path - # e.g., /home/aipass/seed/apps/handlers/standards/file.py -> domain is 'standards' + # e.g., src/aipass/seedgo/apps/handlers/standards/file.py -> domain is 'standards' path_parts = Path(module_path).parts # Find 'handlers' in path and get next directory @@ -398,7 +398,7 @@ def check_template_baseline(module_path: str, bypass_rules: list | None = None) and checks if all template items exist in the branch. Args: - module_path: Path to entry point file (e.g., /home/aipass/aipass_core/api/apps/api.py) + module_path: Path to entry point file (e.g., src/aipass/api/apps/branch.py) Returns: List of check dictionaries for each template item diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/architecture_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/architecture_content.py index 8b9c8190..e2c8a267 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/architecture_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/architecture_content.py @@ -103,9 +103,9 @@ def get_architecture_standards() -> str: "[bold]Exception:[/bold] Service imports OK (e.g., [dim]prax.apps.modules.logger[/dim] system-wide)", "", "[bold cyan]REFERENCE:[/bold cyan]", - " [dim]/home/aipass/standards/CODE_STANDARDS/architecture.md[/dim]", - " [dim]/home/aipass/seed/apps/[/dim] (showroom)", - " [dim]/home/aipass/aipass_core/cortex/apps/[/dim] (production example)", + " [dim]See: seedgo standards pack (architecture)[/dim]", + " [dim]See: src/aipass/seedgo/apps/ (showroom)[/dim]", + " [dim]See: src/aipass/*/apps/ (production examples)[/dim]", ] return "\n".join(lines) diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/cli_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/cli_content.py index 98a47ade..0e65b11f 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/cli_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/cli_content.py @@ -70,13 +70,12 @@ def get_cli_standards() -> str: " • Example: [dim]Commands: cli, display, --help[/dim]", "", "[bold cyan]DEMONSTRATION:[/bold cyan]", - " [dim]/home/aipass/seed/apps/modules/test_cli_errors.py[/dim]", + " [dim]src/aipass/seedgo/apps/standards/aipass/modules/ (standards modules)[/dim]", " Shows CLI service usage with error handling", "", "[bold cyan]REFERENCE:[/bold cyan]", - " [dim]/home/aipass/standards/CODE_STANDARDS/cli.md[/dim]", - " [dim]/home/aipass/aipass_core/cli/README.json[/dim]", - " [dim]/home/aipass/aipass_core/planning/cli_layout_demo.py[/dim]", + " [dim]See: seedgo standards pack (cli)[/dim]", + " [dim]See: src/aipass/cli/ (CLI service provider)[/dim]", "", "─" * 70, "", diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/cli_flags_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/cli_flags_content.py index ad85b0bb..dbc72d0c 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/cli_flags_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/cli_flags_content.py @@ -29,7 +29,7 @@ def get_cli_flags_standards() -> str: Already universal - keep it that way. [bold cyan]--version[/bold cyan] / [bold cyan]-V[/bold cyan] - Print "[dim]BRANCH vX.Y.Z[/dim]" from META DATA HEADER and exit. + Print "[dim]BRANCH vX.Y.Z[/dim]" from the META header and exit. Example: [dim]flow v2.4.0[/dim] [yellow]TIER 2 - RECOMMENDED FLAGS:[/yellow] diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/diagnostics_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/diagnostics_check.py index 9d2c31e6..d31b7cc8 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/diagnostics_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/diagnostics_check.py @@ -25,7 +25,7 @@ from rich.console import Console console = Console() # Import ignore patterns from config handler (same branch) -from ..config.ignore_handler import get_audit_ignore_patterns +from aipass.seedgo.apps.standards.aipass.handlers.config.ignore_handler import get_audit_ignore_patterns def should_ignore_file(file_path: str, ignore_patterns: List[str]) -> bool: @@ -257,7 +257,7 @@ def check_branch(branch_path: str) -> Dict: Run diagnostics on a branch's apps/ directory Args: - branch_path: Path to branch root (e.g., /home/aipass/seed) + branch_path: Path to branch root (e.g., src/aipass/seedgo) Returns: Same format as check_directory diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/documentation_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/documentation_content.py index 20ad9bad..7ca0da03 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/documentation_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/documentation_content.py @@ -30,28 +30,19 @@ def get_documentation_standards() -> str: "", "[bold cyan]REQUIRED: META HEADER (Every Python file)[/bold cyan]", "", - " [dim]#!/home/aipass/.venv/bin/python3[/dim]", - " [dim]# -*- coding: utf-8 -*- # Optional[/dim]", - " [dim][/dim]", - " [dim]# ===================AIPASS====================[/dim]", - " [dim]# META DATA HEADER[/dim]", - " [dim]# Name: filename.py - Brief Description[/dim]", - " [dim]# Date: 2025-XX-XX[/dim]", - " [dim]# Version: 0.1.0[/dim]", - " [dim]# Category: branch or branch/handlers[/dim]", - " [dim]#[/dim]", - " [dim]# CHANGELOG (Max 5 entries):[/dim]", - " [dim]# - v0.1.0 (2025-XX-XX): What changed[/dim]", - " [dim]#[/dim]", - " [dim]# CODE STANDARDS:[/dim]", - " [dim]# - Note about standards followed[/dim]", - " [dim]# ==============================================[/dim]", + " [dim]# =================== META ====================[/dim]", + " [dim]# Name: filename.py[/dim]", + " [dim]# Description: Brief description of the file[/dim]", + " [dim]# Version: 1.0.0[/dim]", + " [dim]# Created: YYYY-MM-DD[/dim]", + " [dim]# Modified: YYYY-MM-DD[/dim]", + " [dim]# =============================================[/dim]", "", "[yellow]KEY RULES:[/yellow]", - " 1. Shebang points to AIPass venv", - " 2. META block = AI-scannable metadata", - " 3. Category shows branch location (cortex vs cortex/handlers)", - " 4. CHANGELOG keeps last 5 versions max", + " 1. META block = AI-scannable metadata", + " 2. Name must match the actual filename", + " 3. Version uses semantic versioning (X.Y.Z)", + " 4. Created/Modified use ISO date format (YYYY-MM-DD)", "", "─" * 70, "", @@ -98,11 +89,10 @@ def get_documentation_standards() -> str: "", "[bold cyan]IMPORT ORGANIZATION[/bold cyan]", "", - " [bold]Order (verified in actual code):[/bold]", - " 1. Infrastructure (AIPASS_ROOT, sys.path) - if needed", - " 2. Standard library imports", - " 3. Prax logger (always: [dim]from prax.apps.modules.logger import system_logger as logger[/dim])", - " 4. Internal handler imports", + " [bold]Order:[/bold]", + " 1. Standard library imports", + " 2. Third-party imports", + " 3. Internal imports ([dim]from aipass.{module}...[/dim])", "", "─" * 70, "", @@ -132,11 +122,10 @@ def get_documentation_standards() -> str: "", "[bold cyan]VERIFICATION:[/bold cyan]", " Standards verified against actual production code:", - " • [dim]/home/aipass/aipass_core/cortex/apps/[/dim]", - " • [dim]/home/aipass/seed/apps/[/dim]", + " • [dim]src/aipass/*/apps/ (all module entry points)[/dim]", "", "[bold cyan]FULL REFERENCE:[/bold cyan]", - " [dim]/home/aipass/standards/CODE_STANDARDS/documentation.md[/dim]", + " [dim]See: seedgo standards pack (documentation)[/dim]", ] return "\n".join(lines) diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/encapsulation_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/encapsulation_check.py index 3c304e91..8a730b19 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/encapsulation_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/encapsulation_check.py @@ -94,7 +94,7 @@ def extract_branch_from_import(import_line: str) -> Optional[str]: Examples: 'from flow.apps.handlers.plan.validator import X' -> 'flow' - 'from aipass_core.api.apps.handlers.openrouter import X' -> 'api' + 'from aipass.api.apps.handlers.openrouter import X' -> 'api' 'from apps.handlers.json import X' -> None (local, no branch) """ # Pattern 1: branch.apps.handlers... diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/error_handling_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/error_handling_content.py index 8264ce05..703b5e84 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/error_handling_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/error_handling_content.py @@ -120,9 +120,9 @@ def get_error_handling_standards() -> str: "─" * 70, "", "[bold cyan]REFERENCE:[/bold cyan]", - " [dim]/home/aipass/standards/CODE_STANDARDS/error_handling.md[/dim]", - " [dim]/home/aipass/aipass_core/flow/apps/modules/ (working example)[/dim]", - " [dim]/home/aipass/seed/apps/modules/ (reference implementation)[/dim]", + " [dim]See: seedgo standards pack (error_handling)[/dim]", + " [dim]See: src/aipass/flow/apps/modules/ (working example)[/dim]", + " [dim]See: src/aipass/seedgo/apps/standards/aipass/modules/ (reference implementation)[/dim]", "", "[bold]Decision:[/bold] 3-Tier approved 2025-11-21, ERROR/WARNING 2026-01-31", "[bold]Status:[/bold] Active - All 18 branches", diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/handlers_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/handlers_check.py index 6fd6f77d..dc9c7252 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/handlers_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/handlers_check.py @@ -149,7 +149,7 @@ def check_handler_independence(content: str, lines: List[str], module_path: str) forbidden_imports = [] # Detect handler's own package - # e.g., /home/aipass/seed/apps/handlers/standards/cli_check.py -> package is 'standards' + # e.g., src/aipass/seedgo/apps/handlers/standards/cli_check.py -> package is 'standards' path_parts = Path(module_path).parts own_package = None for i, part in enumerate(path_parts): diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/handlers_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/handlers_content.py index 73eae588..79265709 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/handlers_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/handlers_content.py @@ -71,10 +71,10 @@ def get_handlers_standards() -> str: " • Drone is [red]NOT imported[/red] by branches", " • Drone resolves @ symbols [yellow]before[/yellow] routing", " • Branches receive [green]resolved paths[/green], never @ symbols", - " • [dim]Example: @flow/plans → /home/aipass/aipass_core/flow/plans[/dim]", + " • [dim]Example: @flow/plans → src/aipass/flow/plans[/dim]", "", " Security guard location: [dim]handlers/__init__.py[/dim]", - " Reference impl: [dim]/home/aipass/aipass_core/prax/apps/handlers/__init__.py[/dim]", + " Reference impl: [dim]src/aipass/prax/apps/handlers/__init__.py[/dim]", "", "[bold]4. Domain Organization[/bold]", " Organize by [yellow]business purpose[/yellow], not technical role:", @@ -116,7 +116,7 @@ def get_handlers_standards() -> str: " [red]✗[/red] Don't use technical organization (utils/, helpers/) - use domains", "", "[bold cyan]REFERENCE:[/bold cyan]", - " [dim]/home/aipass/standards/CODE_STANDARDS/handlers.md[/dim]", + " [dim]See: seedgo standards pack (handlers)[/dim]", "", "─" * 70, ] diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/imports_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/imports_check.py index 7c86a991..12743281 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/imports_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/imports_check.py @@ -49,6 +49,7 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict: 3. Prax logger via aipass.prax namespace (if applicable) 4. Handler independence (no parent module imports) 5. Import order (stdlib -> third-party -> aipass.*) + 6. No bare/invalid imports (must use aipass.* namespace) """ checks = [] path = Path(module_path) @@ -114,6 +115,12 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict: if order_check: checks.append(order_check) + # Check 6: No bare/invalid imports (must use aipass.* namespace) + if not is_init_file: + bare_check = check_no_bare_imports(import_lines, module_path, bypass_rules) + if bare_check: + checks.append(bare_check) + passed_checks = sum(1 for check in checks if check['passed']) total_checks = len(checks) score = int((passed_checks / total_checks * 100)) if total_checks > 0 else 0 @@ -360,3 +367,103 @@ def check_import_order(lines: List[str], file_path: str = "", bypass_rules: list 'passed': True, 'message': 'Import order correct (stdlib before aipass.*)' } + + +def check_no_bare_imports(lines: List[str], file_path: str = "", bypass_rules: list | None = None) -> Optional[Dict]: + """ + Check that file does NOT use bare or invalid import patterns. + + INVALID patterns: + - from handlers.{name} import ... (bare handler import, missing namespace) + - from modules.{name} import ... (bare module import, missing namespace) + - from {module}.apps... (bare module, missing aipass. prefix) + - from seed.apps... (old Dev-Pass namespace) + - from prax.apps... (bare, should be from aipass.prax...) + + VALID patterns: + - from aipass.{module}.apps.modules.{name} import ... + - from aipass.{module}.apps.handlers.{name} import ... + - from .{name} import ... (relative re-export in __init__.py ONLY — excluded by caller) + - Standard library / third-party imports + """ + if is_bypassed(file_path, 'imports', None, bypass_rules): + return {'name': 'No bare imports', 'passed': True, 'message': 'Bypassed by bypass rules'} + + # Known AIPass module names (used to detect bare module imports like "from drone.apps...") + aipass_modules = { + 'drone', 'seedgo', 'prax', 'cli', 'flow', + 'ai_mail', 'api', 'trigger', 'spawn', 'devpulse', + } + + # Old Dev-Pass namespaces that should not appear + old_namespaces = {'seed', 'cortex', 'nexus', 'atlas', 'sentinel'} + + violations = [] + + for i, line in enumerate(lines, 1): + stripped = line.strip() + if not stripped or stripped.startswith('#'): + continue + + code_part = line.split('#')[0].strip() if '#' in line else stripped + + # Only check import statements + if not (code_part.startswith('from ') or code_part.startswith('import ')): + continue + + # Extract the module path from "from X import Y" or "import X" + if code_part.startswith('from '): + # "from X.Y.Z import thing" -> extract "X.Y.Z" + match = re.match(r'from\s+([\w.]+)', code_part) + if not match: + continue + import_path = match.group(1) + else: + # "import X.Y.Z" -> extract "X.Y.Z" + match = re.match(r'import\s+([\w.]+)', code_part) + if not match: + continue + import_path = match.group(1) + + parts = import_path.split('.') + first_part = parts[0] if parts else '' + + # Check 1: Bare handler/module imports (from handlers.X or from modules.X) + if first_part in ('handlers', 'modules'): + violations.append( + f'Line {i}: bare import "from {import_path}" ' + f'(must use aipass.* namespace, e.g. from aipass.seedgo.apps.standards.aipass.{import_path})' + ) + continue + + # Check 2: Old Dev-Pass namespaces (from seed.apps..., from cortex.apps...) + if first_part in old_namespaces and len(parts) > 1: + violations.append( + f'Line {i}: old namespace "from {import_path}" ' + f'(Dev-Pass namespace, must use aipass.* namespace)' + ) + continue + + # Check 3: Bare AIPass module imports (from drone.apps... instead of from aipass.drone.apps...) + if first_part in aipass_modules and len(parts) > 1 and 'apps' in parts: + violations.append( + f'Line {i}: bare module import "from {import_path}" ' + f'(missing aipass. prefix, should be from aipass.{import_path})' + ) + continue + + if violations: + # Show up to 3 violations in the message + shown = violations[:3] + extra = f' (+{len(violations) - 3} more)' if len(violations) > 3 else '' + return { + 'name': 'No bare imports', + 'passed': False, + 'message': '; '.join(shown) + extra + } + + return { + 'name': 'No bare imports', + 'passed': True, + 'message': 'All imports use proper aipass.* namespace' + } diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/imports_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/imports_content.py index 9231d1f0..fe5435ac 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/imports_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/imports_content.py @@ -24,8 +24,8 @@ def get_imports_standards() -> str: "[bold cyan]STANDARD IMPORT ORDER:[/bold cyan]", "", "[bold]1. Infrastructure[/bold]", - " • AIPASS_ROOT = Path.home() / 'aipass_core'", - " • sys.path.insert(0, str(AIPASS_ROOT))", + " • AIPASS_ROOT = Path(__file__).resolve().parents[N]", + " • Use package-relative paths (no sys.path hacks in pip packages)", "", "[bold]2. Standard library[/bold]", " • Grouped by category, alphabetical", @@ -43,12 +43,8 @@ def get_imports_standards() -> str: "[yellow]RULE:[/yellow] Infrastructure → Stdlib → Prax → Services → Internal", "", "[bold cyan]COMPLETE PATTERN:[/bold cyan]", - " [dim]#!/home/aipass/.venv/bin/python3[/dim]", - "", " [dim]import sys[/dim]", " [dim]from pathlib import Path[/dim]", - " [dim]AIPASS_ROOT = Path.home() / 'aipass_core'[/dim]", - " [dim]sys.path.insert(0, str(AIPASS_ROOT))[/dim]", "", " [dim]import json[/dim]", " [dim]from datetime import datetime[/dim]", @@ -56,10 +52,10 @@ def get_imports_standards() -> str: "", " [dim]from prax.apps.modules.logger import system_logger as logger[/dim]", " [dim]from cli.apps.modules import console, header[/dim]", - " [dim]from seed.apps.handlers.json import json_handler[/dim]", + " [dim]from aipass.seedgo.apps.handlers.json import json_handler[/dim]", "", "[bold cyan]CRITICAL RULES:[/bold cyan]", - " [yellow]✓[/yellow] Path.home() - NEVER hardcode /home/username", + " [yellow]✓[/yellow] Path(__file__).resolve().parents[N] - NEVER hardcode paths", " [yellow]✓[/yellow] Absolute imports - NO relative imports (...)", " [yellow]✓[/yellow] Handlers CANNOT import modules (independence)", " [yellow]✓[/yellow] Services before internal (Prax, CLI, then handlers)", @@ -85,19 +81,18 @@ def get_imports_standards() -> str: " • Drone handles PWD detection automatically", "", "[bold]Direct Invocation (Advanced):[/bold]", - " [dim]subprocess.run([\"python3\", \"/home/aipass/aipass_core/ai_mail/apps/ai_mail.py\", ...],[/dim]", + " [dim]subprocess.run([\"drone\", \"@ai_mail\", \"send\", ...],[/dim]", " [dim] cwd=str(branch_dir)) # Force correct working directory[/dim]", " • Must use cwd= parameter for PWD detection to work", "", "[yellow]KEY:[/yellow] AI_MAIL walks up from CWD to find *.id.json for branch identity", "", "[bold cyan]DEMONSTRATION:[/bold cyan]", - " [dim]/home/aipass/seed/apps/modules/create_thing.py[/dim]", - " [dim]/home/aipass/seed/apps/modules/test_cli_errors.py[/dim]", - " [dim]/home/aipass/aipass_core/cli/apps/modules/display.py[/dim]", + " [dim]src/aipass/seedgo/apps/standards/aipass/modules/ (reference modules)[/dim]", + " [dim]src/aipass/cli/apps/modules/ (CLI service examples)[/dim]", "", "[bold cyan]REFERENCE:[/bold cyan]", - " [dim]/home/aipass/standards/CODE_STANDARDS/imports.md[/dim]", + " [dim]See: seedgo standards pack (imports)[/dim]", "", "─" * 70, ] diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/json_structure_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/json_structure_content.py index 25e78329..3c3987b6 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/json_structure_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/json_structure_content.py @@ -56,14 +56,14 @@ def get_json_structure_standards() -> str: " [dim]][/dim]", "", "[bold cyan]LOCATIONS:[/bold cyan]", - " • Seed: [dim]/home/aipass/seed/seed_json/[/dim]", - " • Branches: [dim]/home/aipass/aipass_core/{branch}/{branch}_json/[/dim]", + " • Package JSON: [dim]src/aipass/{module}/aipass_json/[/dim]", + " • Per-module: [dim]src/aipass/{module}/{module}_json/[/dim]", "", "[bold red]SETUP json_handler.py (MANDATORY):[/bold red]", " [red]✗ DO NOT copy SEED's handler without changing paths![/red]", "", " [green]✓ Update BRANCH_ROOT:[/green]", - " [dim]{BRANCH}_ROOT = Path.home() / \"aipass_core\" / \"{branch}\"[/dim]", + " [dim]{BRANCH}_ROOT = Path(__file__).resolve().parents[N][/dim]", "", " [green]✓ Update JSON_DIR:[/green]", " [dim]{BRANCH}_JSON_DIR = {BRANCH}_ROOT / \"{branch}_json\"[/dim]", @@ -80,8 +80,8 @@ def get_json_structure_standards() -> str: " • [dim]Not part of three-JSON pattern[/dim]", "", "[bold cyan]REFERENCE:[/bold cyan]", - " [dim]/home/aipass/standards/CODE_STANDARDS/json_structure.md[/dim]", - " [dim]/home/aipass/seed/apps/handlers/json/json_handler.py[/dim]", + " [dim]See: seedgo standards pack (json_structure)[/dim]", + " [dim]See: src/aipass/seedgo/apps/standards/aipass/handlers/json/json_handler.py[/dim]", ] return "\n".join(lines) diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/modules_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/modules_content.py index ac3cf09c..1ffefa63 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/modules_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/modules_content.py @@ -73,11 +73,11 @@ def get_modules_standards() -> str: " • Heavy file operations belong in handlers, not modules", "", "[bold cyan]DEMONSTRATION:[/bold cyan]", - " [dim]/home/aipass/seed/apps/modules/cli_standard.py[/dim] (135 lines - perfect example)", - " [dim]/home/aipass/seed/apps/modules/test_cli_errors.py[/dim] (283 lines - advanced patterns)", + " [dim]src/aipass/seedgo/apps/standards/aipass/modules/cli_standard.py[/dim] (reference example)", + " [dim]src/aipass/seedgo/apps/standards/aipass/modules/ (all standard modules)[/dim]", "", "[bold cyan]REFERENCE:[/bold cyan]", - " [dim]/home/aipass/standards/CODE_STANDARDS/modules.md[/dim]", + " [dim]See: seedgo standards pack (modules)[/dim]", ] return "\n".join(lines) diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/naming_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/naming_content.py index d7d6dfe7..610eeb16 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/naming_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/naming_content.py @@ -71,7 +71,7 @@ def get_naming_standards() -> str: " [yellow]⚠[/yellow] Legacy code being migrated gradually", "", "[bold cyan]REFERENCE:[/bold cyan]", - " [dim]/home/aipass/standards/CODE_STANDARDS/naming.md[/dim]", + " [dim]See: seedgo standards pack (naming)[/dim]", ] return "\n".join(lines) diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/readme_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/readme_check.py index 6cf45e0e..cd5bc2fb 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/readme_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/readme_check.py @@ -52,7 +52,7 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict: Check if branch README follows standards Args: - module_path: Path to branch entry point (e.g., /home/aipass/seed/apps/seed.py) + module_path: Path to branch entry point (e.g., src/aipass/seedgo/apps/branch.py) bypass_rules: Optional list of bypass rules to skip certain checks Returns: @@ -331,7 +331,7 @@ def check_directory_tree(lines: List[str], branch_root: Path, file_path: str, by # Extract directory names from tree block, line by line # Strip inline comments (text after #) to avoid false positives - # Skip the first non-empty line (root label, e.g., "seed/" or "/home/aipass/.../cortex/") + # Skip the first non-empty line (root label, e.g., "seed/" or "src/aipass/.../cortex/") # Common tree formats: "apps/", "├── apps/", "│ ├── handlers/", " apps/" dir_pattern = re.compile(r'[\w\-_.]+/') branch_name = branch_root.name.lower() diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/readme_generator.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/readme_generator.py index f1d57ee6..b46bcc17 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/readme_generator.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/readme_generator.py @@ -224,7 +224,7 @@ def _get_file_comment(file_path: Path) -> str: try: content = file_path.read_text(encoding='utf-8', errors='ignore') - # Try to extract from META DATA HEADER Name line + # Try to extract from META header Name line name_match = re.search(r'^# Name:\s*\S+\s*-\s*(.+)$', content, re.MULTILINE) if name_match: return name_match.group(1).strip() @@ -311,7 +311,7 @@ def _extract_module_description(module_path: Path) -> str: Extract description from a Python module file. Tries (in order): - 1. META DATA HEADER Name line (after the dash) + 1. META header Name line (after the dash) 2. First line of module docstring 3. Empty string @@ -324,7 +324,7 @@ def _extract_module_description(module_path: Path) -> str: try: content = module_path.read_text(encoding='utf-8', errors='ignore') - # Try META DATA HEADER Name line + # Try META header Name line name_match = re.search(r'^# Name:\s*\S+\s*-\s*(.+)$', content, re.MULTILINE) if name_match: return name_match.group(1).strip() diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/shebang_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/shebang_check.py new file mode 100644 index 00000000..ba7ffed5 --- /dev/null +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/shebang_check.py @@ -0,0 +1,102 @@ +""" +Shebang Standards Checker Handler + +Validates that Python files do not contain shebang lines (#!/...). +AIPass is a pip-installable package -- all execution goes through +pyproject.toml entry points or python3 -m. Shebangs are unnecessary +and should be removed. +""" + +# =================== META ==================== +# Name: shebang_check.py +# Description: Shebang Standards Checker Handler +# Version: 1.0.0 +# Created: 2026-03-06 +# Modified: 2026-03-06 +# ============================================= + + +from pathlib import Path +from typing import Dict + + +def is_bypassed(file_path: str, standard: str, bypass_rules: list | None = None) -> bool: + """Check if a violation should be bypassed""" + if not bypass_rules: + return False + for rule in bypass_rules: + if rule.get('standard') and rule.get('standard') != standard: + continue + rule_file = rule.get('file', '') + if rule_file and rule_file not in file_path: + continue + rule_lines = rule.get('lines', []) + if not rule_lines: + return True + return False + + +def check_module(module_path: str, bypass_rules: list | None = None) -> Dict: + """ + Check if a Python file contains a shebang line. + + Shebangs (#!/...) are not needed in pip packages -- all execution + goes through pyproject.toml entry points or python3 -m. + + Args: + module_path: Path to Python module to check + bypass_rules: Optional list of bypass rules to skip certain checks + + Returns: + dict: { + 'passed': bool, + 'checks': [{'name': str, 'passed': bool, 'message': str}], + 'score': int, + 'standard': str + } + """ + path = Path(module_path) + + if is_bypassed(module_path, 'shebang', bypass_rules=bypass_rules): + return { + 'passed': True, + 'checks': [{'name': 'Bypassed', 'passed': True, 'message': 'Standard bypassed via .seed/bypass.json'}], + 'score': 100, + 'standard': 'SHEBANG' + } + + if not path.exists(): + return { + 'passed': False, + 'checks': [{'name': 'File exists', 'passed': False, 'message': f'File not found: {module_path}'}], + 'score': 0, + 'standard': 'SHEBANG' + } + + try: + with open(path, 'r', encoding='utf-8') as f: + first_line = f.readline() + except Exception as e: + return { + 'passed': False, + 'checks': [{'name': 'File readable', 'passed': False, 'message': f'Error reading file: {e}'}], + 'score': 0, + 'standard': 'SHEBANG' + } + + # Check line 1 for shebang + if first_line.startswith('#!'): + return { + 'passed': False, + 'checks': [{'name': 'No shebang line', 'passed': False, + 'message': 'Shebang lines are not needed in pip packages -- remove #!/... from line 1'}], + 'score': 0, + 'standard': 'SHEBANG' + } + + return { + 'passed': True, + 'checks': [{'name': 'No shebang line', 'passed': True, 'message': 'No shebang line found'}], + 'score': 100, + 'standard': 'SHEBANG' + } diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/trigger_content.py b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/trigger_content.py index 0703ac01..04137bba 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/standards/trigger_content.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/standards/trigger_content.py @@ -121,9 +121,9 @@ def get_trigger_standards() -> str: " [dim]•[/dim] Graceful degradation if Trigger unavailable", "", "[bold cyan]REFERENCE:[/bold cyan]", - " [dim]/home/aipass/seed/standards/CODE_STANDARDS/trigger.md[/dim]", - " [dim]/home/aipass/aipass_core/trigger/apps/modules/core.py[/dim]", - " [dim]/home/aipass/aipass_core/trigger/apps/handlers/events/[/dim]", + " [dim]See: seedgo standards pack (trigger)[/dim]", + " [dim]See: src/aipass/trigger/apps/modules/core.py[/dim]", + " [dim]See: src/aipass/trigger/apps/handlers/events/[/dim]", ] return "\n".join(lines) diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/verify/command_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/verify/command_check.py index 77769f9a..5ecf06e5 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/verify/command_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/verify/command_check.py @@ -18,7 +18,7 @@ import sys from pathlib import Path from typing import Dict -from ..file import file_handler +from aipass.seedgo.apps.standards.aipass.handlers.file import file_handler def check_command_consistency() -> Dict: diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/verify/help_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/verify/help_check.py index bd654d16..f2c31212 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/verify/help_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/verify/help_check.py @@ -18,8 +18,8 @@ import sys from pathlib import Path from typing import Dict -from ..file import file_handler -from seed.apps.handlers.config import ignore_handler +from aipass.seedgo.apps.standards.aipass.handlers.file import file_handler +from aipass.seedgo.apps.standards.aipass.handlers.config import ignore_handler def check_help_consistency() -> Dict: diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/verify/orchestrator.py b/src/aipass/seedgo/apps/standards/aipass/handlers/verify/orchestrator.py index 475524af..08603bb6 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/verify/orchestrator.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/verify/orchestrator.py @@ -25,11 +25,11 @@ from typing import Dict from aipass.cli import console, header # Check handlers -from ..verify.stale_check import check_stale_patterns -from ..verify.freshness_check import check_file_freshness -from ..verify.help_check import check_help_consistency -from ..verify.command_check import check_command_consistency -from ..verify.checker_sync import check_checker_sync +from aipass.seedgo.apps.standards.aipass.handlers.verify.stale_check import check_stale_patterns +from aipass.seedgo.apps.standards.aipass.handlers.verify.freshness_check import check_file_freshness +from aipass.seedgo.apps.standards.aipass.handlers.verify.help_check import check_help_consistency +from aipass.seedgo.apps.standards.aipass.handlers.verify.command_check import check_command_consistency +from aipass.seedgo.apps.standards.aipass.handlers.verify.checker_sync import check_checker_sync def run_verification() -> Dict: diff --git a/src/aipass/seedgo/apps/standards/aipass/handlers/verify/stale_check.py b/src/aipass/seedgo/apps/standards/aipass/handlers/verify/stale_check.py index 781ba98f..db2d4476 100644 --- a/src/aipass/seedgo/apps/standards/aipass/handlers/verify/stale_check.py +++ b/src/aipass/seedgo/apps/standards/aipass/handlers/verify/stale_check.py @@ -19,12 +19,12 @@ import subprocess from pathlib import Path from typing import Dict -from seed.apps.handlers.config import ignore_handler +from aipass.seedgo.apps.standards.aipass.handlers.config import ignore_handler def check_stale_patterns() -> Dict: """ - Check for deprecated patterns in /home/aipass/seed/ + Check for deprecated patterns in the seedgo package Returns: Dict with check results diff --git a/src/aipass/seedgo/apps/standards/aipass/modules/architecture_standard.py b/src/aipass/seedgo/apps/standards/aipass/modules/architecture_standard.py index 99614ccf..d52fe89b 100755 --- a/src/aipass/seedgo/apps/standards/aipass/modules/architecture_standard.py +++ b/src/aipass/seedgo/apps/standards/aipass/modules/architecture_standard.py @@ -19,8 +19,8 @@ from pathlib import Path from typing import List from aipass.prax import logger -from handlers.json import json_handler -from handlers.standards.architecture_content import get_architecture_standards +from aipass.seedgo.apps.standards.aipass.handlers.json import json_handler +from aipass.seedgo.apps.standards.aipass.handlers.standards.architecture_content import get_architecture_standards # Import CLI services (Rich console + display functions) from aipass.cli import console, header @@ -81,7 +81,7 @@ def print_help(): console.print() console.print("[yellow]REFERENCE:[/yellow]") - console.print(" /home/aipass/standards/CODE_STANDARDS/architecture.md") + console.print(" See: seedgo standards pack (architecture)") console.print() diff --git a/src/aipass/seedgo/apps/standards/aipass/modules/cli_flags_standard.py b/src/aipass/seedgo/apps/standards/aipass/modules/cli_flags_standard.py index 2774f4e2..13e87fbd 100644 --- a/src/aipass/seedgo/apps/standards/aipass/modules/cli_flags_standard.py +++ b/src/aipass/seedgo/apps/standards/aipass/modules/cli_flags_standard.py @@ -19,8 +19,8 @@ from pathlib import Path from typing import List from aipass.prax import logger -from handlers.json import json_handler -from handlers.standards.cli_flags_content import get_cli_flags_standards +from aipass.seedgo.apps.standards.aipass.handlers.json import json_handler +from aipass.seedgo.apps.standards.aipass.handlers.standards.cli_flags_content import get_cli_flags_standards from aipass.cli import console, header diff --git a/src/aipass/seedgo/apps/standards/aipass/modules/cli_standard.py b/src/aipass/seedgo/apps/standards/aipass/modules/cli_standard.py index 45a43d2b..50314aee 100755 --- a/src/aipass/seedgo/apps/standards/aipass/modules/cli_standard.py +++ b/src/aipass/seedgo/apps/standards/aipass/modules/cli_standard.py @@ -20,8 +20,8 @@ from typing import List from aipass.prax import logger -from handlers.json import json_handler -from handlers.standards.cli_content import get_cli_standards +from aipass.seedgo.apps.standards.aipass.handlers.json import json_handler +from aipass.seedgo.apps.standards.aipass.handlers.standards.cli_content import get_cli_standards # Import CLI services (Rich console + display functions) from aipass.cli import console, header @@ -79,7 +79,7 @@ def print_help(): console.print() console.print("[yellow]REFERENCE:[/yellow]") - console.print(" /home/aipass/standards/CODE_STANDARDS/cli.md") + console.print(" See: seedgo standards pack (cli)") console.print() diff --git a/src/aipass/seedgo/apps/standards/aipass/modules/diagnostics_audit.py b/src/aipass/seedgo/apps/standards/aipass/modules/diagnostics_audit.py index 3ca9f623..92b94180 100644 --- a/src/aipass/seedgo/apps/standards/aipass/modules/diagnostics_audit.py +++ b/src/aipass/seedgo/apps/standards/aipass/modules/diagnostics_audit.py @@ -28,14 +28,14 @@ from aipass.cli import console from aipass.cli import header # JSON handler for logging -from handlers.json import json_handler +from aipass.seedgo.apps.standards.aipass.handlers.json import json_handler # Drone services for @ resolution from aipass.drone.apps.modules import normalize_branch_arg # Diagnostics handlers -from handlers.diagnostics.discovery import discover_branches -from handlers.diagnostics.runner import run_branch_diagnostics +from aipass.seedgo.apps.standards.aipass.handlers.diagnostics.discovery import discover_branches +from aipass.seedgo.apps.standards.aipass.handlers.diagnostics.runner import run_branch_diagnostics def print_branch_diagnostics(result: Dict): diff --git a/src/aipass/seedgo/apps/standards/aipass/modules/documentation_standard.py b/src/aipass/seedgo/apps/standards/aipass/modules/documentation_standard.py index 66b79b5d..3d94c24f 100755 --- a/src/aipass/seedgo/apps/standards/aipass/modules/documentation_standard.py +++ b/src/aipass/seedgo/apps/standards/aipass/modules/documentation_standard.py @@ -19,8 +19,8 @@ from pathlib import Path from typing import List from aipass.prax import logger -from handlers.json import json_handler -from handlers.standards.documentation_content import get_documentation_standards +from aipass.seedgo.apps.standards.aipass.handlers.json import json_handler +from aipass.seedgo.apps.standards.aipass.handlers.standards.documentation_content import get_documentation_standards # Import CLI services (Rich console + display functions) from aipass.cli import console, header @@ -57,7 +57,7 @@ def print_help(): console.print() console.print("[yellow]REFERENCE:[/yellow]") - console.print(" /home/aipass/standards/CODE_STANDARDS/documentation.md") + console.print(" See: seedgo standards pack (documentation)") console.print() diff --git a/src/aipass/seedgo/apps/standards/aipass/modules/error_handling_standard.py b/src/aipass/seedgo/apps/standards/aipass/modules/error_handling_standard.py index 81718e5f..1dbc454c 100644 --- a/src/aipass/seedgo/apps/standards/aipass/modules/error_handling_standard.py +++ b/src/aipass/seedgo/apps/standards/aipass/modules/error_handling_standard.py @@ -20,8 +20,8 @@ from typing import List from aipass.prax import logger -from handlers.json import json_handler -from handlers.standards.error_handling_content import get_error_handling_standards +from aipass.seedgo.apps.standards.aipass.handlers.json import json_handler +from aipass.seedgo.apps.standards.aipass.handlers.standards.error_handling_content import get_error_handling_standards # Import CLI services (Rich console + display functions) from aipass.cli import console, header @@ -83,7 +83,7 @@ def print_help(): console.print() console.print("[yellow]REFERENCE:[/yellow]") - console.print(" /home/aipass/standards/CODE_STANDARDS/error_handling.md") + console.print(" See: seedgo standards pack (error_handling)") console.print() diff --git a/src/aipass/seedgo/apps/standards/aipass/modules/handlers_standard.py b/src/aipass/seedgo/apps/standards/aipass/modules/handlers_standard.py index 37020db3..5eb21f48 100755 --- a/src/aipass/seedgo/apps/standards/aipass/modules/handlers_standard.py +++ b/src/aipass/seedgo/apps/standards/aipass/modules/handlers_standard.py @@ -19,8 +19,8 @@ from pathlib import Path from typing import List from aipass.prax import logger -from handlers.json import json_handler -from handlers.standards.handlers_content import get_handlers_standards +from aipass.seedgo.apps.standards.aipass.handlers.json import json_handler +from aipass.seedgo.apps.standards.aipass.handlers.standards.handlers_content import get_handlers_standards # Import CLI services (Rich console + display functions) from aipass.cli import console, header @@ -79,8 +79,8 @@ def print_help(): console.print() console.print("[yellow]REFERENCE:[/yellow]") - console.print(" /home/aipass/standards/CODE_STANDARDS/handlers.md") - console.print(" /home/aipass/standards/CODE_STANDARDS/json_structure.md") + console.print(" See: seedgo standards pack (handlers)") + console.print(" See: seedgo standards pack (json_structure)") console.print() diff --git a/src/aipass/seedgo/apps/standards/aipass/modules/imports_standard.py b/src/aipass/seedgo/apps/standards/aipass/modules/imports_standard.py index 36f2df48..5966b233 100755 --- a/src/aipass/seedgo/apps/standards/aipass/modules/imports_standard.py +++ b/src/aipass/seedgo/apps/standards/aipass/modules/imports_standard.py @@ -20,8 +20,8 @@ from typing import List from aipass.prax import logger -from handlers.json import json_handler -from handlers.standards.imports_content import get_imports_standards +from aipass.seedgo.apps.standards.aipass.handlers.json import json_handler +from aipass.seedgo.apps.standards.aipass.handlers.standards.imports_content import get_imports_standards # Import CLI services (Rich console + display functions) from aipass.cli import console, header @@ -79,7 +79,7 @@ def print_help(): console.print() console.print("[yellow]REFERENCE:[/yellow]") - console.print(" /home/aipass/standards/CODE_STANDARDS/imports.md") + console.print(" See: seedgo standards pack (imports)") console.print() diff --git a/src/aipass/seedgo/apps/standards/aipass/modules/json_structure_standard.py b/src/aipass/seedgo/apps/standards/aipass/modules/json_structure_standard.py index 4695660b..02c7b30c 100755 --- a/src/aipass/seedgo/apps/standards/aipass/modules/json_structure_standard.py +++ b/src/aipass/seedgo/apps/standards/aipass/modules/json_structure_standard.py @@ -20,8 +20,8 @@ from typing import List from aipass.prax import logger -from handlers.json import json_handler -from handlers.standards.json_structure_content import get_json_structure_standards +from aipass.seedgo.apps.standards.aipass.handlers.json import json_handler +from aipass.seedgo.apps.standards.aipass.handlers.standards.json_structure_content import get_json_structure_standards # Import CLI services (Rich console + display functions) from aipass.cli import console, header @@ -81,7 +81,7 @@ def print_help(): console.print() console.print("[yellow]REFERENCE:[/yellow]") - console.print(" /home/aipass/standards/CODE_STANDARDS/json_structure.md") + console.print(" See: seedgo standards pack (json_structure)") console.print() diff --git a/src/aipass/seedgo/apps/standards/aipass/modules/log_handler_standard.py b/src/aipass/seedgo/apps/standards/aipass/modules/log_handler_standard.py index 03f23c3f..932042a9 100644 --- a/src/aipass/seedgo/apps/standards/aipass/modules/log_handler_standard.py +++ b/src/aipass/seedgo/apps/standards/aipass/modules/log_handler_standard.py @@ -19,8 +19,8 @@ from pathlib import Path from typing import List from aipass.prax import logger -from handlers.json import json_handler -from handlers.standards.log_handler_content import get_log_handler_standards +from aipass.seedgo.apps.standards.aipass.handlers.json import json_handler +from aipass.seedgo.apps.standards.aipass.handlers.standards.log_handler_content import get_log_handler_standards from aipass.cli import console, header diff --git a/src/aipass/seedgo/apps/standards/aipass/modules/log_level_standard.py b/src/aipass/seedgo/apps/standards/aipass/modules/log_level_standard.py index bb613347..63117dc2 100644 --- a/src/aipass/seedgo/apps/standards/aipass/modules/log_level_standard.py +++ b/src/aipass/seedgo/apps/standards/aipass/modules/log_level_standard.py @@ -19,8 +19,8 @@ from pathlib import Path from typing import List from aipass.prax import logger -from handlers.json import json_handler -from handlers.standards.log_level_content import get_log_level_standards +from aipass.seedgo.apps.standards.aipass.handlers.json import json_handler +from aipass.seedgo.apps.standards.aipass.handlers.standards.log_level_content import get_log_level_standards from aipass.cli import console, header diff --git a/src/aipass/seedgo/apps/standards/aipass/modules/log_visibility_standard.py b/src/aipass/seedgo/apps/standards/aipass/modules/log_visibility_standard.py index b948bebc..ae3d9a77 100644 --- a/src/aipass/seedgo/apps/standards/aipass/modules/log_visibility_standard.py +++ b/src/aipass/seedgo/apps/standards/aipass/modules/log_visibility_standard.py @@ -19,8 +19,8 @@ from pathlib import Path from typing import List from aipass.prax import logger -from handlers.json import json_handler -from handlers.standards.log_visibility_content import get_log_visibility_standards +from aipass.seedgo.apps.standards.aipass.handlers.json import json_handler +from aipass.seedgo.apps.standards.aipass.handlers.standards.log_visibility_content import get_log_visibility_standards from aipass.cli import console, header diff --git a/src/aipass/seedgo/apps/standards/aipass/modules/modules_standard.py b/src/aipass/seedgo/apps/standards/aipass/modules/modules_standard.py index 8fe23ba9..6407ade2 100755 --- a/src/aipass/seedgo/apps/standards/aipass/modules/modules_standard.py +++ b/src/aipass/seedgo/apps/standards/aipass/modules/modules_standard.py @@ -19,8 +19,8 @@ from pathlib import Path from typing import List from aipass.prax import logger -from handlers.json import json_handler -from handlers.standards.modules_content import get_modules_standards +from aipass.seedgo.apps.standards.aipass.handlers.json import json_handler +from aipass.seedgo.apps.standards.aipass.handlers.standards.modules_content import get_modules_standards # Import CLI services (Rich console + display functions) from aipass.cli import console, header @@ -78,7 +78,7 @@ def print_help(): console.print() console.print("[yellow]REFERENCE:[/yellow]") - console.print(" /home/aipass/standards/CODE_STANDARDS/modules.md") + console.print(" See: seedgo standards pack (modules)") console.print() diff --git a/src/aipass/seedgo/apps/standards/aipass/modules/naming_standard.py b/src/aipass/seedgo/apps/standards/aipass/modules/naming_standard.py index 382f8ca2..fc50f8e1 100755 --- a/src/aipass/seedgo/apps/standards/aipass/modules/naming_standard.py +++ b/src/aipass/seedgo/apps/standards/aipass/modules/naming_standard.py @@ -20,8 +20,8 @@ from typing import List from aipass.prax import logger -from handlers.json import json_handler -from handlers.standards.naming_content import get_naming_standards +from aipass.seedgo.apps.standards.aipass.handlers.json import json_handler +from aipass.seedgo.apps.standards.aipass.handlers.standards.naming_content import get_naming_standards # Import CLI services (Rich console + display functions) from aipass.cli import console, header @@ -79,7 +79,7 @@ def print_help(): console.print() console.print("[yellow]REFERENCE:[/yellow]") - console.print(" /home/aipass/standards/CODE_STANDARDS/naming.md") + console.print(" See: seedgo standards pack (naming)") console.print() diff --git a/src/aipass/seedgo/apps/standards/aipass/modules/permission_flags_standard.py b/src/aipass/seedgo/apps/standards/aipass/modules/permission_flags_standard.py index 25378713..ecbb6bce 100644 --- a/src/aipass/seedgo/apps/standards/aipass/modules/permission_flags_standard.py +++ b/src/aipass/seedgo/apps/standards/aipass/modules/permission_flags_standard.py @@ -19,8 +19,8 @@ from pathlib import Path from typing import List from aipass.prax import logger -from handlers.json import json_handler -from handlers.standards.permission_flags_content import get_permission_flags_standards +from aipass.seedgo.apps.standards.aipass.handlers.json import json_handler +from aipass.seedgo.apps.standards.aipass.handlers.standards.permission_flags_content import get_permission_flags_standards from aipass.cli import console, header diff --git a/src/aipass/seedgo/apps/standards/aipass/modules/readme_update.py b/src/aipass/seedgo/apps/standards/aipass/modules/readme_update.py index f9b60469..dae0ac24 100644 --- a/src/aipass/seedgo/apps/standards/aipass/modules/readme_update.py +++ b/src/aipass/seedgo/apps/standards/aipass/modules/readme_update.py @@ -31,13 +31,13 @@ from typing import List # Prax logger (system-wide, always first) from aipass.prax import logger # JSON handler for tracking -from handlers.json import json_handler +from aipass.seedgo.apps.standards.aipass.handlers.json import json_handler # CLI services (display/output formatting) from aipass.cli import console, header # Handler (implementation) -from handlers.standards.readme_ops import ( +from aipass.seedgo.apps.standards.aipass.handlers.standards.readme_ops import ( load_generator, resolve_targets, SECTION_NAMES, diff --git a/src/aipass/seedgo/apps/standards/aipass/modules/standards_audit.py b/src/aipass/seedgo/apps/standards/aipass/modules/standards_audit.py index 65ddd193..3ce9c4ac 100755 --- a/src/aipass/seedgo/apps/standards/aipass/modules/standards_audit.py +++ b/src/aipass/seedgo/apps/standards/aipass/modules/standards_audit.py @@ -31,19 +31,19 @@ from collections import defaultdict # Prax logger (system-wide, always first) from aipass.prax import logger # JSON handler for tracking -from handlers.json import json_handler +from aipass.seedgo.apps.standards.aipass.handlers.json import json_handler # CLI services (display/output formatting) from aipass.cli import console, header # Audit handlers (implementation) -from handlers.audit.discovery import discover_branches, _is_branch_private -from handlers.audit.branch_audit import audit_branch -from handlers.audit.bypass_audit import audit_bypasses -from handlers.audit.display import print_branch_summary, print_system_summary, print_bypass_audit +from aipass.seedgo.apps.standards.aipass.handlers.audit.discovery import discover_branches, _is_branch_private +from aipass.seedgo.apps.standards.aipass.handlers.audit.branch_audit import audit_branch +from aipass.seedgo.apps.standards.aipass.handlers.audit.bypass_audit import audit_bypasses +from aipass.seedgo.apps.standards.aipass.handlers.audit.display import print_branch_summary, print_system_summary, print_bypass_audit # Bypass system - import from checklist -from modules.standards_checklist import load_bypass_rules +from aipass.seedgo.apps.standards.aipass.modules.standards_checklist import load_bypass_rules # Drone services for @ resolution from aipass.drone.apps.modules import normalize_branch_arg diff --git a/src/aipass/seedgo/apps/standards/aipass/modules/standards_checklist.py b/src/aipass/seedgo/apps/standards/aipass/modules/standards_checklist.py index 7ed09c58..b73ba453 100755 --- a/src/aipass/seedgo/apps/standards/aipass/modules/standards_checklist.py +++ b/src/aipass/seedgo/apps/standards/aipass/modules/standards_checklist.py @@ -32,29 +32,30 @@ from datetime import datetime # Prax logger (system-wide, always first) from aipass.prax import logger # JSON handler for tracking -from handlers.json import json_handler +from aipass.seedgo.apps.standards.aipass.handlers.json import json_handler # CLI services (display/output formatting) from aipass.cli import console, header # Standards checkers -from handlers.standards import imports_check -from handlers.standards import architecture_check -from handlers.standards import naming_check -from handlers.standards import cli_check -from handlers.standards import handlers_check -from handlers.standards import modules_check -from handlers.standards import documentation_check -from handlers.standards import json_structure_check -from handlers.standards import testing_check -from handlers.standards import error_handling_check -from handlers.standards import encapsulation_check -from handlers.standards import trigger_check -from handlers.standards import log_level_check -from handlers.standards import cli_flags_check -from handlers.standards import log_handler_check -from handlers.standards import log_visibility_check -from handlers.standards import permission_flags_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import imports_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import architecture_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import naming_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import cli_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import handlers_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import modules_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import documentation_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import json_structure_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import testing_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import error_handling_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import encapsulation_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import trigger_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import log_level_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import cli_flags_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import log_handler_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import log_visibility_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import permission_flags_check +from aipass.seedgo.apps.standards.aipass.handlers.standards import shebang_check # ============================================================================= # BYPASS SYSTEM - .seed/ config per branch @@ -243,25 +244,25 @@ def print_help(): console.print(" drone @seed checklist ") console.print() console.print(" [dim]# Standalone[/dim]") - console.print(" python3 /home/aipass/seed/apps/modules/standards_checklist.py ") - console.print(" python3 /home/aipass/seed/apps/modules/standards_checklist.py --introspect") - console.print(" python3 /home/aipass/seed/apps/modules/standards_checklist.py --help") + console.print(" drone @seedgo checklist ") + console.print(" drone @seedgo checklist --introspect") + console.print(" drone @seedgo checklist --help") console.print() console.print("[yellow]EXAMPLES:[/yellow]") - console.print(" [dim]# Check a seed module[/dim]") - console.print(" python3 /home/aipass/seed/apps/modules/standards_checklist.py /home/aipass/seed/apps/modules/imports_standard.py") + console.print(" [dim]# Check a seedgo module[/dim]") + console.print(" drone @seedgo checklist src/aipass/seedgo/apps/standards/aipass/modules/imports_standard.py") console.print() console.print(" [dim]# Check a different branch module[/dim]") - console.print(" python3 /home/aipass/seed/apps/modules/standards_checklist.py /home/aipass/aipass_core/api/apps/api.py") + console.print(" drone @seedgo checklist src/aipass/api/apps/branch.py") console.print() console.print(" [dim]# Show json_handler introspection[/dim]") - console.print(" python3 /home/aipass/seed/apps/modules/standards_checklist.py --introspect") + console.print(" drone @seedgo checklist --introspect") console.print() console.print("[yellow]REFERENCE:[/yellow]") console.print(" Checks imports, architecture, naming, CLI, handlers, modules,") - console.print(" documentation, JSON structure, testing, and error handling standards.") + console.print(" documentation, JSON structure, testing, error handling, and shebang standards.") console.print() @@ -271,7 +272,7 @@ def print_json_handler_introspection(): header("json_handler.py INTROSPECTION") console.print() console.print("[bold cyan]Auto-Creating & Self-Healing JSON System[/bold cyan]") - console.print("[dim]Location: /home/aipass/seed/apps/handlers/json/json_handler.py[/dim]") + console.print("[dim]Location: aipass/seedgo/apps/standards/aipass/handlers/json/json_handler.py[/dim]") console.print() # OVERVIEW @@ -359,12 +360,12 @@ def print_json_handler_introspection(): # FILE LOCATIONS console.print("[bold white]FILE LOCATIONS:[/bold white]") - console.print(" Templates: [cyan]/home/aipass/seed/apps/json_templates/default/[/cyan]") + console.print(" Templates: [cyan]/apps/json_templates/default/[/cyan]") console.print(" - config.json") console.print(" - data.json") console.print(" - log.json") console.print() - console.print(" Generated: [cyan]/home/aipass/seed/seed_json/[/cyan]") + console.print(" Generated: [cyan]/aipass_json/[/cyan]") console.print(" - {module_name}_config.json") console.print(" - {module_name}_data.json") console.print(" - {module_name}_log.json") @@ -383,7 +384,7 @@ def print_json_handler_introspection(): # CONSTANTS console.print("[bold white]CONSTANTS:[/bold white]") - console.print(" [dim]SEED_ROOT = Path.home() / 'seed'[/dim]") + console.print(" [dim]PACK_ROOT = Path(__file__).resolve().parent.parent.parent[/dim]") console.print(" [dim]SEED_JSON_DIR = SEED_ROOT / 'seed_json'[/dim]") console.print(" [dim]JSON_TEMPLATES_DIR = SEED_ROOT / 'apps' / 'json_templates'[/dim]") console.print() @@ -440,16 +441,16 @@ def print_checklist(args: List[str]): header("Standards Checklist") console.print() console.print("[yellow]USAGE:[/yellow]") - console.print(" python3 /home/aipass/seed/apps/modules/standards_checklist.py ") + console.print(" drone @seedgo checklist ") console.print() console.print("[yellow]EXAMPLES:[/yellow]") - console.print(" # Check a seed module") - console.print(" python3 /home/aipass/seed/apps/modules/standards_checklist.py /home/aipass/seed/apps/modules/imports_standard.py") + console.print(" # Check a seedgo module") + console.print(" drone @seedgo checklist src/aipass/seedgo/apps/standards/aipass/modules/imports_standard.py") console.print() console.print(" # Check a different branch module") - console.print(" python3 /home/aipass/seed/apps/modules/standards_checklist.py /home/aipass/aipass_core/api/apps/api.py") + console.print(" drone @seedgo checklist src/aipass/api/apps/branch.py") console.print() - console.print("[yellow]AVAILABLE CHECKERS (17/17 COMPLETE):[/yellow]") + console.print("[yellow]AVAILABLE CHECKERS (18/18 COMPLETE):[/yellow]") console.print(" [green]✓[/green] imports_check - Import standards validation") console.print(" [green]✓[/green] architecture_check - Architecture standards validation") console.print(" [green]✓[/green] naming_check - Naming standards validation") @@ -465,6 +466,7 @@ def print_checklist(args: List[str]): console.print(" [green]✓[/green] log_handler_check - Log handler rotation (RotatingFileHandler required)") console.print(" [green]✓[/green] log_visibility_check - Log visibility (prax system_logger required)") console.print(" [green]✓[/green] permission_flags_check - Permission flags (no --skip-permissions)") + console.print(" [green]✓[/green] shebang_check - Shebang line detection (no #!/... in pip packages)") console.print() console.print("─" * 70) console.print() @@ -825,10 +827,29 @@ def print_checklist(args: List[str]): console.print() logger.info(f"[{MODULE_NAME}] PERMISSION_FLAGS check complete: {permission_flags_score}/100") + # Run shebang check + logger.info(f"[{MODULE_NAME}] Running SHEBANG standard check on {file_path}") + console.print("[bold cyan]SHEBANG STANDARD:[/bold cyan]") + shebang_result = shebang_check.check_module(file_path, bypass_rules=bypass_rules) + + # Display results + for check in shebang_result['checks']: + symbol = "[green]✓[/green]" if check['passed'] else "[red]✗[/red]" + console.print(f" {symbol} {check['name']}: {check['message']}") + + console.print() + + # Show score + shebang_score = shebang_result['score'] + shebang_status = "[green]PASS[/green]" if shebang_result['passed'] else "[red]FAIL[/red]" + console.print(f" Score: {shebang_score}/100 - {shebang_status}") + console.print() + logger.info(f"[{MODULE_NAME}] SHEBANG check complete: {shebang_score}/100") + # Overall summary - avg_score = int((imports_score + architecture_score + naming_score + cli_score + handlers_score + modules_score + documentation_score + json_structure_score + testing_score + error_handling_score + encapsulation_score + trigger_score + log_level_score + cli_flags_score + log_handler_score + log_visibility_score + permission_flags_score) / 17) + avg_score = int((imports_score + architecture_score + naming_score + cli_score + handlers_score + modules_score + documentation_score + json_structure_score + testing_score + error_handling_score + encapsulation_score + trigger_score + log_level_score + cli_flags_score + log_handler_score + log_visibility_score + permission_flags_score + shebang_score) / 18) console.print("─" * 70) - console.print(f"[bold]OVERALL:[/bold] 17/17 standards checked - {avg_score}% average compliance") + console.print(f"[bold]OVERALL:[/bold] 18/18 standards checked - {avg_score}% average compliance") console.print("─" * 70) console.print() logger.info(f"[{MODULE_NAME}] Standards check complete: {avg_score}% average compliance") diff --git a/src/aipass/seedgo/apps/standards/aipass/modules/trigger_standard.py b/src/aipass/seedgo/apps/standards/aipass/modules/trigger_standard.py index 5e2cd127..cf49086a 100644 --- a/src/aipass/seedgo/apps/standards/aipass/modules/trigger_standard.py +++ b/src/aipass/seedgo/apps/standards/aipass/modules/trigger_standard.py @@ -19,8 +19,8 @@ from pathlib import Path from typing import List from aipass.prax import logger -from handlers.json import json_handler -from handlers.standards.trigger_content import get_trigger_standards +from aipass.seedgo.apps.standards.aipass.handlers.json import json_handler +from aipass.seedgo.apps.standards.aipass.handlers.standards.trigger_content import get_trigger_standards # Import CLI services (Rich console + display functions) from aipass.cli import console, header @@ -74,7 +74,7 @@ def print_help(): console.print() console.print("[yellow]REFERENCE:[/yellow]") - console.print(" /home/aipass/seed/standards/CODE_STANDARDS/trigger.md") + console.print(" See: seedgo standards pack (trigger)") console.print() diff --git a/src/aipass/seedgo/docs/aipass_code_standards/architecture.md b/src/aipass/seedgo/docs/aipass_code_standards/architecture.md index 56dddd2c..91275cad 100644 --- a/src/aipass/seedgo/docs/aipass_code_standards/architecture.md +++ b/src/aipass/seedgo/docs/aipass_code_standards/architecture.md @@ -64,42 +64,14 @@ apps/handlers/ (Implementation Layer) **Regenerate template registry:** When template structure changes, run: ```bash -python3 /home/aipass/aipass_core/cortex/apps/modules/regenerate_template_registry.py +python3 -m aipass.spawn.apps.modules.regenerate_template_registry ``` --- -## File Permissions for Python Modules +## No Shebangs or Execute Permissions Required -**CRITICAL REQUIREMENT:** All Python files MUST have execute permissions set. - -```bash -chmod +x /path/to/module.py -``` - -**WHY:** The shebang line (`#!/home/aipass/.venv/bin/python3`) only works if the file has execute permissions. Without this, attempting to run the file directly results in "Permission denied" errors. - -**When to apply:** -- Immediately after creating any new Python file -- After using Write/Edit tools to create files -- Before committing changes to repository - -**Verification:** -```bash -ls -la module.py -# Should show: -rwxr-xr-x (execute permissions for owner) -``` - -**Fix all at once:** -```bash -# Make all Python files in modules/ executable -chmod +x apps/modules/*.py - -# Fix entire branch -find apps/ -name "*.py" -exec chmod +x {} \; -``` - -**Common mistake:** Creating file with shebang but forgetting `chmod +x`, leading to confusion when direct execution fails but `python3 file.py` works. +AIPass is a pip package. All execution goes through entry points defined in `pyproject.toml` or `python3 -m`. Shebangs and execute permissions are not needed. --- diff --git a/src/aipass/seedgo/docs/aipass_code_standards/cli_flags.md b/src/aipass/seedgo/docs/aipass_code_standards/cli_flags.md index 96f04f1c..4e5b500a 100644 --- a/src/aipass/seedgo/docs/aipass_code_standards/cli_flags.md +++ b/src/aipass/seedgo/docs/aipass_code_standards/cli_flags.md @@ -31,7 +31,7 @@ When Patrick or an agent runs `drone @flow --verbose` or `drone @trigger --versi | Flag | Short | Behavior | |------|-------|----------| | `--help` | `-h`, `help` | Show Rich-formatted help with Commands line for drone discovery | -| `--version` | `-V` | Print branch name and version from META DATA HEADER | +| `--version` | `-V` | Print branch name and version from META header | ### Tier 2: Recommended (when applicable) @@ -62,12 +62,12 @@ Print the branch name and version, then exit. BRANCH_NAME v1.2.3 ``` -**Where the version comes from:** Every branch entry point has a META DATA HEADER with a `Version:` field. Read it from there. +**Where the version comes from:** Every branch entry point has a META header with a `Version:` field. Read it from there. **Implementation:** ```python def show_version(): - """Print version from META DATA HEADER.""" + """Print version from META header.""" console.print("SEED v3.0.0") # In main(): @@ -274,7 +274,7 @@ This standard does not require immediate system-wide changes. Recommended rollou **Phase 1: Add `--version` to all branches** - Lowest effort, highest value -- Just read the META DATA HEADER version string +- Just read the META header version string - Can be done branch-by-branch **Phase 2: Add `--test` to core branches** diff --git a/src/aipass/seedgo/docs/aipass_code_standards/documentation.md b/src/aipass/seedgo/docs/aipass_code_standards/documentation.md index 0602ee52..2f218b7f 100644 --- a/src/aipass/seedgo/docs/aipass_code_standards/documentation.md +++ b/src/aipass/seedgo/docs/aipass_code_standards/documentation.md @@ -1,6 +1,6 @@ # Documentation Standards -**Status:** v1.0 - Verified against actual codebase -**Date:** 2025-11-13 +**Status:** v2.0 - Aligned with meta_check.py (source of truth) +**Date:** 2026-03-06 --- @@ -9,20 +9,12 @@ Every Python file follows this header pattern: ```python -#!/home/aipass/.venv/bin/python3 - -# ===================AIPASS==================== -# META DATA HEADER -# Name: filename.py - Brief Description -# Date: YYYY-MM-DD -# Version: X.Y.Z -# Category: branch_name or branch_name/handlers -# -# CHANGELOG (Max 5 entries): -# - vX.Y.Z (YYYY-MM-DD): Change description -# -# CODE STANDARDS: -# - Error handling: Use error handler system +# =================== META ==================== +# Name: filename.py +# Description: Brief description of the file +# Version: 1.0.0 +# Created: 2026-03-06 +# Modified: 2026-03-06 # ============================================= """ @@ -36,104 +28,50 @@ Key functionality: """ ``` -**NOTE:** Some files also include `# -*- coding: utf-8 -*-` after the shebang line (seen in cortex files). This is optional but valid. - --- -## Shebang Line +## No Shebangs Required -```python -#!/home/aipass/.venv/bin/python3 -# -*- coding: utf-8 -*- # Optional - seen in some cortex files -``` - -**WHY:** Points to AIPass venv, ensuring correct Python environment and dependencies. - -**EXCEPTION - MEMORY_BANK:** -```python -#!/home/aipass/MEMORY_BANK/.venv/bin/python3 -``` -MEMORY_BANK uses its own isolated virtual environment at `/home/aipass/MEMORY_BANK/.venv`. - -**IMPORTANT - EXECUTE PERMISSIONS:** - -After creating a Python file, make it executable: -```bash -chmod +x /path/to/file.py -``` - -**WHY:** The shebang line only works if the file has execute permissions. Without `chmod +x`, you'll get "Permission denied" errors when trying to run the file directly. - -**When to set:** -- Immediately after creating any new Python module -- After using Write tool to create files -- Verify with: `ls -la file.py` (should show `-rwxr-xr-x`) - -**Fix all modules at once:** -```bash -# Make all Python files in a directory executable -chmod +x /path/to/modules/*.py -``` - -**VERIFIED IN:** -- `/home/aipass/aipass_core/cortex/apps/modules/create_branch.py` -- `/home/aipass/aipass_core/cortex/apps/handlers/branch/file_ops.py` -- `/home/aipass/seed/apps/handlers/domain1/ops.py` +AIPass is a pip package. All execution goes through entry points defined in `pyproject.toml` or `python3 -m`. Shebangs are not needed and should not be added. --- ## META Block -**Standard format:** +**Standard format (enforced by `meta_check.py`):** ```python -# ===================AIPASS==================== -# META DATA HEADER -# Name: create_branch.py - Create New AIPass Branch -# Date: 2025-11-10 -# Version: 2.1.0 -# Category: cortex -# -# CHANGELOG (Max 5 entries): -# - v2.1.0 (2025-11-10): Added template placeholder system -# - v2.0.0 (2025-11-08): Complete rewrite with handler architecture -# -# CODE STANDARDS: -# - Error handling: Use error handler system (apps/handlers/error/) +# =================== META ==================== +# Name: example_module.py +# Description: Example module for demonstration +# Version: 1.0.0 +# Created: 2026-03-06 +# Modified: 2026-03-06 # ============================================= ``` -**Fields:** -- **Name:** Filename + dash-separated description -- **Date:** Creation date (YYYY-MM-DD) -- **Version:** Semantic versioning (major.minor.patch) -- **Category:** Branch name (e.g., `cortex`) or `cortex/handlers` for handlers -- **CHANGELOG:** Max 5 entries - version, date, what changed -- **CODE STANDARDS:** Reference to error handler (standard across all files) +**Required fields:** +- **Name:** Must match the actual filename (e.g., `example_module.py`) +- **Description:** Brief description of what the file does +- **Version:** Semantic versioning (X.Y.Z) +- **Created:** Date the file was created (YYYY-MM-DD) +- **Modified:** Date the file was last modified (YYYY-MM-DD) + +**Markers:** +- Header: `# =================== META ====================` +- Footer: `# =============================================` + +**Rules:** +- `__init__.py` files are exempt (skipped by checker) +- Name field is validated against the actual filename +- All five fields are required +- Pass threshold: 75% of checks **WHY META blocks:** - **AI scannable:** Agents can extract metadata without parsing code - **Version tracking:** Know what version you're looking at immediately -- **History at a glance:** Recent changes visible without git log +- **Traceability:** Created/Modified dates show file history at a glance - **Standardization:** Every file has same metadata structure -**Handler example:** -```python -# Category: cortex/handlers -# Category: seed/handlers/domain1 -``` - -**Module example:** -```python -# Category: cortex -# Category: seed/test -``` - -**VERIFIED IN:** -- `/home/aipass/aipass_core/cortex/apps/modules/create_branch.py` (Category: cortex) -- `/home/aipass/aipass_core/cortex/apps/handlers/branch/file_ops.py` (Category: cortex/handlers) -- `/home/aipass/seed/apps/modules/test_cli_errors.py` (Category: seed/test) -- `/home/aipass/seed/apps/handlers/domain1/ops.py` (Category: seed/handlers/domain1) - --- ## Module-Level Docstrings @@ -182,23 +120,19 @@ Functions for file and directory operations: """ ``` -**With usage example (verified from actual code):** +**With usage example:** ```python """ -Error Handler Decorators +Standards Checker -Decorators for automatic error handling, logging, and result formatting. +Validates code against AIPass standards. Usage: - from cortex.apps.handlers.error_handler import track_operation + from aipass.seedgo.apps.modules.checker import run_checks - @track_operation - def my_function(arg): - # Just write business logic - return result + results = run_checks(module_path) """ ``` -*From: `/home/aipass/aipass_core/cortex/apps/handlers/error/decorators.py`* **WHY:** First thing you see after metadata. Tells you what the file does and key features. No need to read code to understand purpose. @@ -228,40 +162,35 @@ def function_name(arg1: Type, arg2: Type) -> ReturnType: """ ``` -**Real examples (verified from actual code):** +**Examples:** ```python -def find_existing_memory_files(target_dir: Path, branch_name: str) -> Dict[str, Path]: +def find_files(target_dir: Path, branch_name: str) -> Dict[str, Path]: """ - Find existing memory files with any naming convention (hyphens, underscores, etc.) + Find files matching branch naming convention. Args: target_dir: Path to branch directory branch_name: Branch name to match against Returns: - Dict mapping file types (main, local, observations, ai_mail, id) to Path objects + Dict mapping file types to Path objects """ ``` -*From: `/home/aipass/aipass_core/cortex/apps/handlers/branch/file_ops.py`* ```python -def create_operation(name: str, data: Dict[str, Any]) -> Dict[str, Any]: +def check_module(module_path: str, bypass_rules: list | None = None) -> Dict: """ - Demonstrate domain-specific business logic - - [SHOWROOM] This would contain actual implementation. - Shows structure, typing, documentation patterns. + Check if module has a valid library-profile META block. Args: - name: Thing name - data: Thing configuration + module_path: Path to Python module to check + bypass_rules: Optional bypass rules Returns: - Operation result dict with success/error/details + dict with passed, checks, score, standard keys """ ``` -*From: `/home/aipass/seed/apps/handlers/domain1/ops.py`* **WHY Google-style:** - **Readable:** Args/Returns sections visually separate @@ -334,34 +263,24 @@ def copy_template_contents( - `METADATA EXTRACTION` - `STANDALONE EXECUTION` -**Example (verified from create_branch.py):** +**Example:** ```python # ============================================================================= # CONSTANTS # ============================================================================= -# Get template directory -AIPASS_ROOT = Path.home() / "aipass_core" -TEMPLATE_DIR = AIPASS_ROOT / "cortex" / "templates" / "branch_template" - -# Files to exclude from template copy -EXCLUDE_PATTERNS = [ - "setup_instructions", - "new_branch_setup.py", - "upgrade_branch.py", - ".git", - "__pycache__", -] +MODULE_DIR = Path(__file__).parent +EXCLUDE_PATTERNS = [".git", "__pycache__"] ``` -**Example (verified from file_ops.py):** +**Example:** ```python # ============================================================================= # FILE DISCOVERY AND MATCHING # ============================================================================= -def find_existing_memory_files(target_dir: Path, branch_name: str) -> Dict[str, Path]: - """Find existing memory files with any naming convention""" +def find_files(target_dir: Path, branch_name: str) -> Dict[str, Path]: + """Find files matching branch naming convention""" ``` **WHY:** @@ -396,18 +315,15 @@ backup() remove() ``` -**Examples from actual codebase:** +**Examples:** ```python # Memory file suffixes to check (JSON format) -memory_suffixes = [".json", ".local.json", ".observations.json", ".ai_mail.json", ".id.json"] +memory_suffixes = [".json", ".local.json", ".observations.json"] # Normalize to check if it matches branch name prefix_normalized = prefix.replace("-", "_").upper() ``` -*From: `/home/aipass/aipass_core/cortex/apps/handlers/branch/file_ops.py`* - -Note: The PROTECTION RULE example is a pattern that may exist in other files but was not verified in the sample files examined. **When NOT to use:** - Obvious code (don't narrate what's already clear) @@ -423,53 +339,34 @@ Note: The PROTECTION RULE example is a pattern that may exist in other files but ## Import Organization -**Standard pattern (verified from actual code):** +**Standard pattern:** ```python -#!/home/aipass/.venv/bin/python3 -# -*- coding: utf-8 -*- - # [META BLOCK] """Module docstring""" -# Infrastructure setup (if needed) -import sys -from pathlib import Path -AIPASS_ROOT = Path.home() / "aipass_core" -sys.path.insert(0, str(AIPASS_ROOT)) - # Standard library imports import json -from datetime import datetime -from typing import Dict, List, Optional, Tuple +from pathlib import Path +from typing import Dict, List, Optional -# Prax logger -from prax.apps.modules.logger import system_logger as logger +# Third-party imports (if any) -# Internal handler imports -from cortex.apps.handlers.json import json_handler -from cortex.apps.handlers.branch import file_ops +# Internal imports (always use pip namespace) +from aipass.module.apps.modules import something ``` -**VERIFIED IN:** -- `/home/aipass/aipass_core/cortex/apps/modules/create_branch.py` -- `/home/aipass/aipass_core/cortex/apps/handlers/branch/file_ops.py` -- `/home/aipass/seed/apps/modules/test_cli_errors.py` - **Import sections (in order):** -1. Infrastructure setup (AIPASS_ROOT, sys.path) - if needed -2. Standard library imports -3. Prax logger (always from prax.apps.modules.logger) -4. Internal/local handler imports +1. Standard library imports +2. Third-party imports +3. Internal imports (always `from aipass.{module}...`) **WHY this order:** -- **Infrastructure first:** Must run before other imports can work - **Standard library grouped:** Easy to see external dependencies -- **Prax consistent:** Always `from prax.apps.modules.logger import system_logger as logger` +- **Third-party separate:** Clear boundary between stdlib and packages - **Internal last:** After all external dependencies resolved - -**NOTE:** Some modules use try/except blocks to gracefully handle missing handlers (see create_branch.py for example). +- **Namespace required:** Always `from aipass.{module}...`, never bare imports --- @@ -482,19 +379,16 @@ from cortex.apps.handlers.branch import file_ops # CONSTANTS # ============================================================================= -# Get template directory -AIPASS_ROOT = Path.home() / "aipass_core" -TEMPLATE_DIR = AIPASS_ROOT / "cortex" / "templates" / "branch_template" +# Paths resolved relative to module location +MODULE_DIR = Path(__file__).parent # Files to exclude from template copy EXCLUDE_PATTERNS = [ - "setup_instructions", - "new_branch_setup.py", ".git", "__pycache__", ] -# Files to rename after copying +# Configuration mappings FILE_RENAMES = { "LOCAL.json": "{BRANCHNAME}.local.json", "OBSERVATIONS.json": "{BRANCHNAME}.observations.json", @@ -505,18 +399,18 @@ FILE_RENAMES = { - **ALL_CAPS signals:** This is configuration, not a variable - **Comments explain purpose:** Not just WHAT, but WHY we need it - **Grouped together:** All config in one place, easy to modify +- **No hardcoded paths:** Use `Path(__file__)` or registry lookups --- ## Summary: Documentation Hierarchy **File level (top to bottom):** -1. Shebang +1. Module docstring (optional, before META) 2. META block (metadata) -3. Module docstring (purpose) -4. Imports (organized) -5. Constants (configuration) -6. Section separators + functions (implementation) +3. Imports (organized) +4. Constants (configuration) +5. Section separators + functions (implementation) **Function level:** - Type hints (signature) @@ -534,34 +428,20 @@ FILE_RENAMES = { | Element | Pattern | Required? | |---------|---------|-----------| -| Shebang | `#!/home/aipass/.venv/bin/python3` | Yes | -| META Block | AIPASS format | **Yes** | +| META Block | Library META format (5 fields) | **Yes** | | Module Docstring | Triple-quoted | **Yes** | | Function Docstring | Google-style | **Yes** | | Type Hints | Full typing | **Yes** | | Section Separators | `# ===...===` | Recommended | | Inline Comments | Clarification only | As needed | -| Import Organization | Infrastructure → Standard → Prax → Internal | Yes | +| Import Organization | Standard → Third-party → Internal | Yes | -**The standard:** If Cortex or Seed does it, that's the pattern. These aren't theoretical - verified against actual production code in: -- `/home/aipass/aipass_core/cortex/apps/` -- `/home/aipass/seed/apps/` +**Source of truth:** `meta_check.py` defines and enforces the META block format. --- ## Verification Notes -**Files examined for truth-checking (2025-11-13):** -- `/home/aipass/aipass_core/cortex/apps/modules/create_branch.py` -- `/home/aipass/aipass_core/cortex/apps/handlers/branch/file_ops.py` -- `/home/aipass/aipass_core/cortex/apps/handlers/error/decorators.py` -- `/home/aipass/seed/apps/modules/test_cli_errors.py` -- `/home/aipass/seed/apps/handlers/domain1/ops.py` +**Source of truth for META format:** `seedgo/apps/standards/aipass/handlers/standards/meta_check.py` -All patterns, examples, and file paths verified against actual code. - -## Comments - -#@comments:2025-11-13:claude: All examples now include source file references for verification -#@comments:2025-11-13:claude: Updated encoding line as optional (present in cortex, optional in seed) -#@comments:2025-11-13:claude: Corrected memory_suffixes list to include .ai_mail.json and .id.json +META block format aligned with checker enforcement on 2026-03-06. diff --git a/src/aipass/seedgo/tests/conftest.py b/src/aipass/seedgo/tests/conftest.py index fbf87211..7c598544 100644 --- a/src/aipass/seedgo/tests/conftest.py +++ b/src/aipass/seedgo/tests/conftest.py @@ -1,24 +1,8 @@ -#!/home/aipass/.venv/bin/python3 - -# ===================AIPASS==================== -# META DATA HEADER -# Name: tests/conftest.py -# Date: 2025-11-08 -# Version: 1.0.0 -# Category: cortex/tests -# -# CHANGELOG (Max 5 entries): -# - v1.0.0 (2025-11-08): Initial implementation - Shared pytest fixtures -# -# CODE STANDARDS: -# - Error handling: Use error handler system (apps/handlers/error/) -# ============================================= - -"""Shared pytest fixtures for cortex tests""" +"""Shared pytest fixtures for seedgo tests""" # =================== META ==================== # Name: conftest.py -# Description: Shared pytest fixtures for cortex tests +# Description: Shared pytest fixtures for seedgo tests # Version: 1.0.0 # Created: 2026-03-05 # Modified: 2026-03-05 diff --git a/src/aipass/spawn/apps/__init__.py b/src/aipass/spawn/apps/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/aipass/spawn/apps/handlers/__init__.py b/src/aipass/spawn/apps/handlers/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/aipass/spawn/apps/modules/__init__.py b/src/aipass/spawn/apps/modules/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/aipass/spawn/apps/spawn.py b/src/aipass/spawn/apps/spawn.py new file mode 100644 index 00000000..6113c7aa --- /dev/null +++ b/src/aipass/spawn/apps/spawn.py @@ -0,0 +1,116 @@ +""" +SPAWN Branch - Agent Creation System + +Creates new AIPass agents from templates. +Provides CLI interface to the spawn_agent() workflow. +""" + +import sys +import argparse + +from aipass.prax.apps.modules.logger import system_logger as logger +from aipass.cli.apps.modules import console, header + + +def print_help(): + """Display Rich-formatted help.""" + console.print() + header("SPAWN - Agent Creation System") + console.print() + console.print("[dim]Create new AIPass agents from templates[/dim]") + console.print() + console.print("[bold cyan]USAGE:[/bold cyan]") + console.print() + console.print(" [dim]drone @spawn create [options][/dim]") + console.print(" [dim]drone @spawn --help[/dim]") + console.print() + console.print("[bold cyan]COMMANDS:[/bold cyan]") + console.print() + console.print(" [green]create[/green] Create a new agent from template") + console.print() + console.print("[bold cyan]OPTIONS:[/bold cyan]") + console.print() + console.print(" [yellow]--role[/yellow] Agent role description") + console.print(" [yellow]--traits[/yellow] Agent personality traits") + console.print(" [yellow]--purpose[/yellow] Agent purpose (brief)") + console.print(" [yellow]--template[/yellow] Custom template directory") + console.print(" [yellow]--registry[/yellow] Path to AIPASS_REGISTRY.json") + console.print() + + +def handle_create(args): + """Handle the create command.""" + from aipass.spawn.spawn import spawn_agent + + if not args: + console.print("[red]Error: target path required[/red]") + console.print("[dim]Usage: drone @spawn create [--role ...][/dim]") + return 1 + + parser = argparse.ArgumentParser(prog="spawn create", add_help=False) + parser.add_argument("target_path") + parser.add_argument("--role", default="") + parser.add_argument("--traits", default="") + parser.add_argument("--purpose", default="") + parser.add_argument("--template", default=None) + parser.add_argument("--registry", default=None) + + parsed = parser.parse_args(args) + + result = spawn_agent( + target_path=parsed.target_path, + role=parsed.role, + traits=parsed.traits, + purpose=parsed.purpose, + template_dir=parsed.template, + registry_path=parsed.registry, + ) + + if result["success"]: + console.print() + console.print(f"[green]Agent created: {result['branch_name']}[/green]") + console.print(f" Path: {result['path']}") + console.print(f" Files: {result['files_copied']}") + console.print(f" Registry: {'updated' if result['registry_updated'] else 'not updated'}") + if result["validation_issues"]: + console.print(f" [yellow]Warnings: {len(result['validation_issues'])} unreplaced placeholders[/yellow]") + console.print() + return 0 + else: + console.print(f"[red]Error: {result['error']}[/red]") + return 1 + + +def main(): + """Main entry point.""" + args = sys.argv[1:] + + if len(args) == 0 or args[0] in ["--help", "-h", "help"]: + print_help() + return 0 + + if args[0] in ["--version", "-V"]: + console.print("SPAWN v1.0.0") + return 0 + + command = args[0] + remaining = args[1:] if len(args) > 1 else [] + + if command == "create": + return handle_create(remaining) + + console.print(f"[red]Unknown command: {command}[/red]") + console.print("[dim]Run 'drone @spawn --help' for available commands[/dim]") + return 1 + + +if __name__ == "__main__": + try: + sys.exit(main()) + except KeyboardInterrupt: + console.print("\n\nOperation cancelled by user") + sys.exit(0) + except Exception as e: + logger.error(f"SPAWN entry point error: {e}", exc_info=True) + console.print(f"\nError: {e}") + sys.exit(1) diff --git a/src/aipass/spawn/templates/agent.template/tests/conftest.py b/src/aipass/spawn/templates/agent.template/tests/conftest.py index a87088fd..3cccc54b 100644 --- a/src/aipass/spawn/templates/agent.template/tests/conftest.py +++ b/src/aipass/spawn/templates/agent.template/tests/conftest.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/spawn/templates/agent.template/tools/verify_branch.py b/src/aipass/spawn/templates/agent.template/tools/verify_branch.py index 4464af6d..082e64ec 100644 --- a/src/aipass/spawn/templates/agent.template/tools/verify_branch.py +++ b/src/aipass/spawn/templates/agent.template/tools/verify_branch.py @@ -1,5 +1,3 @@ -#!/home/aipass/.venv/bin/python3 -# -*- coding: utf-8 -*- # ===================AIPASS==================== # META DATA HEADER @@ -30,12 +28,14 @@ from pathlib import Path from typing import Set, List, Tuple from fnmatch import fnmatch -# INFRASTRUCTURE IMPORT PATTERN -AIPASS_ROOT = Path.home() / "aipass_core" -sys.path.insert(0, str(AIPASS_ROOT)) +# Resolve paths relative to this file's location +# verify_branch.py lives at /tools/verify_branch.py +# Template dir is at /templates/agent.template/ +_THIS_DIR = Path(__file__).resolve().parent +_MODULE_DIR = _THIS_DIR.parent # The module (or template) root -# Get template directory -TEMPLATE_DIR = AIPASS_ROOT / "cortex" / "templates" / "branch_template" +# Get template directory — walk up to spawn/templates/agent.template/ +TEMPLATE_DIR = _MODULE_DIR def load_ignore_patterns() -> Tuple[List[str], List[str]]: diff --git a/src/aipass/spawn/templates/agent_mock_branch/tests/conftest.py b/src/aipass/spawn/templates/agent_mock_branch/tests/conftest.py index a87088fd..3cccc54b 100644 --- a/src/aipass/spawn/templates/agent_mock_branch/tests/conftest.py +++ b/src/aipass/spawn/templates/agent_mock_branch/tests/conftest.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/spawn/templates/agent_mock_branch/tools/verify_branch.py b/src/aipass/spawn/templates/agent_mock_branch/tools/verify_branch.py index 4464af6d..082e64ec 100644 --- a/src/aipass/spawn/templates/agent_mock_branch/tools/verify_branch.py +++ b/src/aipass/spawn/templates/agent_mock_branch/tools/verify_branch.py @@ -1,5 +1,3 @@ -#!/home/aipass/.venv/bin/python3 -# -*- coding: utf-8 -*- # ===================AIPASS==================== # META DATA HEADER @@ -30,12 +28,14 @@ from pathlib import Path from typing import Set, List, Tuple from fnmatch import fnmatch -# INFRASTRUCTURE IMPORT PATTERN -AIPASS_ROOT = Path.home() / "aipass_core" -sys.path.insert(0, str(AIPASS_ROOT)) +# Resolve paths relative to this file's location +# verify_branch.py lives at /tools/verify_branch.py +# Template dir is at /templates/agent.template/ +_THIS_DIR = Path(__file__).resolve().parent +_MODULE_DIR = _THIS_DIR.parent # The module (or template) root -# Get template directory -TEMPLATE_DIR = AIPASS_ROOT / "cortex" / "templates" / "branch_template" +# Get template directory — walk up to spawn/templates/agent.template/ +TEMPLATE_DIR = _MODULE_DIR def load_ignore_patterns() -> Tuple[List[str], List[str]]: diff --git a/src/aipass/trigger/apps/handlers/__init__.py b/src/aipass/trigger/apps/handlers/__init__.py index bdde4f1b..55cb7ed3 100644 --- a/src/aipass/trigger/apps/handlers/__init__.py +++ b/src/aipass/trigger/apps/handlers/__init__.py @@ -28,7 +28,7 @@ def _extract_branch_name(filepath: str) -> str: """Extract branch name from a file path.""" parts = filepath.split("/") for i, part in enumerate(parts): - if part in ("aipass_core", "MEMORY_BANK", "seed", ".vscode"): + if part in ("aipass", "seed", ".vscode"): if i + 1 < len(parts): return parts[i + 1] if part in ("aipass",) and i + 1 < len(parts) and parts[i + 1] == "apps": diff --git a/src/aipass/trigger/apps/handlers/error_registry.py b/src/aipass/trigger/apps/handlers/error_registry.py index a5b9aaa2..5f8abc10 100644 --- a/src/aipass/trigger/apps/handlers/error_registry.py +++ b/src/aipass/trigger/apps/handlers/error_registry.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -43,7 +42,7 @@ Architecture: is held in-memory (resets on process restart). Storage: - /home/aipass/aipass_core/trigger/trigger_json/error_registry.json + trigger/trigger_json/error_registry.json Format: { "errors": {fingerprint: ErrorEvent_as_dict, ...}, "metadata": {"version": "2.0.0", "last_updated": "..."} @@ -455,7 +454,7 @@ def normalize_message(message: str) -> str: # Strip date-only patterns (2026-02-13) normalized = re.sub(r'\d{4}-\d{2}-\d{2}', '', normalized) - # Strip absolute paths (/home/aipass/... or any /path/to/something) + # Strip absolute paths (any /path/to/something) normalized = re.sub(r'/[\w./-]+', '', normalized) # Strip line numbers ("line 42" -> "line N") diff --git a/src/aipass/trigger/apps/handlers/events/bulletin_created.py b/src/aipass/trigger/apps/handlers/events/bulletin_created.py index d418211a..e4895a82 100644 --- a/src/aipass/trigger/apps/handlers/events/bulletin_created.py +++ b/src/aipass/trigger/apps/handlers/events/bulletin_created.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -37,11 +36,19 @@ from datetime import datetime from pathlib import Path from typing import Any, Dict, List -AIPASS_HOME = Path.home() +def _find_repo_root() -> Path: + """Walk up from this file to find the repo root (contains AIPASS_REGISTRY.json).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + +_REPO_ROOT = _find_repo_root() # Paths -BRANCH_REGISTRY = AIPASS_HOME / "BRANCH_REGISTRY.json" -BULLETINS_PATH = AIPASS_HOME / "aipass_os" / "AI_CENTRAL" / "BULLETINS.central.json" +BRANCH_REGISTRY = _REPO_ROOT / "BRANCH_REGISTRY.json" +BULLETINS_PATH = _REPO_ROOT / "BULLETINS.central.json" def _load_branch_registry() -> List[Dict]: diff --git a/src/aipass/trigger/apps/handlers/events/cli.py b/src/aipass/trigger/apps/handlers/events/cli.py index 64058726..3585c424 100644 --- a/src/aipass/trigger/apps/handlers/events/cli.py +++ b/src/aipass/trigger/apps/handlers/events/cli.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/trigger/apps/handlers/events/error_detected.py b/src/aipass/trigger/apps/handlers/events/error_detected.py index 8c951131..acb556a5 100644 --- a/src/aipass/trigger/apps/handlers/events/error_detected.py +++ b/src/aipass/trigger/apps/handlers/events/error_detected.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -58,9 +57,17 @@ from pathlib import Path from typing import Any, Callable, Dict, List, Optional from aipass.trigger.apps.config import TRIGGER_ROOT -AIPASS_HOME = Path.home() +def _find_repo_root() -> Path: + """Walk up from this file to find the repo root (contains AIPASS_REGISTRY.json).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() -BRANCH_REGISTRY_FILE = AIPASS_HOME / "BRANCH_REGISTRY.json" +_REPO_ROOT = _find_repo_root() + +BRANCH_REGISTRY_FILE = _REPO_ROOT / "BRANCH_REGISTRY.json" TRIGGER_CONFIG_FILE = TRIGGER_ROOT / "trigger_json" / "trigger_config.json" # Email send callback (set by module layer, avoids handler importing from modules) diff --git a/src/aipass/trigger/apps/handlers/events/error_logged.py b/src/aipass/trigger/apps/handlers/events/error_logged.py index ed6673f8..50141bad 100644 --- a/src/aipass/trigger/apps/handlers/events/error_logged.py +++ b/src/aipass/trigger/apps/handlers/events/error_logged.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -50,10 +49,18 @@ from pathlib import Path from typing import Any, Dict, List from aipass.trigger.apps.config import TRIGGER_ROOT -AIPASS_HOME = Path.home() +def _find_repo_root() -> Path: + """Walk up from this file to find the repo root (contains AIPASS_REGISTRY.json).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + +_REPO_ROOT = _find_repo_root() TRIGGER_CONFIG_FILE = TRIGGER_ROOT / "trigger_json" / "trigger_config.json" -BRANCH_REGISTRY_FILE = AIPASS_HOME / "BRANCH_REGISTRY.json" +BRANCH_REGISTRY_FILE = _REPO_ROOT / "BRANCH_REGISTRY.json" SUPPRESSED_LOG = TRIGGER_ROOT / "logs" / "medic_suppressed.log" # Legacy rate limiting diff --git a/src/aipass/trigger/apps/handlers/events/memory.py b/src/aipass/trigger/apps/handlers/events/memory.py index fcf19b2c..c6a0a465 100644 --- a/src/aipass/trigger/apps/handlers/events/memory.py +++ b/src/aipass/trigger/apps/handlers/events/memory.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/trigger/apps/handlers/events/memory_template_updated.py b/src/aipass/trigger/apps/handlers/events/memory_template_updated.py index a6c26382..76a794a1 100644 --- a/src/aipass/trigger/apps/handlers/events/memory_template_updated.py +++ b/src/aipass/trigger/apps/handlers/events/memory_template_updated.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -34,7 +33,8 @@ Event data expected: from pathlib import Path from typing import Any -AIPASS_HOME = Path.home() + +# Path resolution not needed - this handler delegates to Memory Bank's pusher def handle_memory_template_updated(**kwargs: Any) -> None: diff --git a/src/aipass/trigger/apps/handlers/events/memory_threshold_exceeded.py b/src/aipass/trigger/apps/handlers/events/memory_threshold_exceeded.py index d67f4788..62b2bd17 100644 --- a/src/aipass/trigger/apps/handlers/events/memory_threshold_exceeded.py +++ b/src/aipass/trigger/apps/handlers/events/memory_threshold_exceeded.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -39,7 +38,8 @@ from datetime import datetime from pathlib import Path from typing import Any -AIPASS_HOME = Path.home() + +# Path resolution not needed - this handler uses only event data passed in kwargs def _build_compression_message( diff --git a/src/aipass/trigger/apps/handlers/events/plan_file.py b/src/aipass/trigger/apps/handlers/events/plan_file.py index 3cae558c..90cd9488 100644 --- a/src/aipass/trigger/apps/handlers/events/plan_file.py +++ b/src/aipass/trigger/apps/handlers/events/plan_file.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -39,7 +38,15 @@ from pathlib import Path from typing import Optional from aipass.trigger.apps.config import TRIGGER_ROOT, AIPASS_PKG_ROOT -ECOSYSTEM_ROOT = Path("/home/aipass") +def _find_repo_root() -> Path: + """Walk up from this file to find the repo root (contains AIPASS_REGISTRY.json).""" + current = Path(__file__).resolve().parent + for parent in [current] + list(current.parents): + if (parent / "AIPASS_REGISTRY.json").exists(): + return parent + return Path.cwd() + +REPO_ROOT = _find_repo_root() # Registry JSON file path (direct file access, no handler imports) FLOW_JSON_DIR = AIPASS_PKG_ROOT / "flow" / "flow_json" @@ -108,7 +115,7 @@ def handle_plan_file_created(path: str, **kwargs): # If plan is closed, preserve closed status and just update location if existing_plan.get("status") == "closed": existing_plan["location"] = str(file_path.parent) - existing_plan["relative_path"] = str(file_path.parent.relative_to(ECOSYSTEM_ROOT)) + existing_plan["relative_path"] = str(file_path.parent.relative_to(REPO_ROOT)) existing_plan["file_path"] = str(file_path) existing_plan["last_updated"] = datetime.now(timezone.utc).isoformat() _save_registry(registry) @@ -117,7 +124,7 @@ def handle_plan_file_created(path: str, **kwargs): return # Add to registry - relative_path = str(file_path.parent.relative_to(ECOSYSTEM_ROOT)) + relative_path = str(file_path.parent.relative_to(REPO_ROOT)) registry.setdefault("plans", {})[plan_number] = { "location": str(file_path.parent), "relative_path": relative_path, @@ -195,7 +202,7 @@ def handle_plan_file_moved(src_path: str, dest_path: str, **kwargs): plans = registry.get("plans", {}) if plan_number in plans: - relative_path = str(dest_file.parent.relative_to(ECOSYSTEM_ROOT)) + relative_path = str(dest_file.parent.relative_to(REPO_ROOT)) # CRITICAL: Only update location fields, preserve ALL other metadata # (status, closed, closed_reason, memory_created, memory_created_date, etc.) diff --git a/src/aipass/trigger/apps/handlers/events/registry.py b/src/aipass/trigger/apps/handlers/events/registry.py index e963ba60..bb6a130e 100644 --- a/src/aipass/trigger/apps/handlers/events/registry.py +++ b/src/aipass/trigger/apps/handlers/events/registry.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/trigger/apps/handlers/events/startup.py b/src/aipass/trigger/apps/handlers/events/startup.py index 6aa4833d..a6053623 100644 --- a/src/aipass/trigger/apps/handlers/events/startup.py +++ b/src/aipass/trigger/apps/handlers/events/startup.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -38,9 +37,7 @@ from datetime import datetime, timedelta from typing import Any, Callable, Dict, List, Optional, Set from aipass.trigger.apps.config import TRIGGER_ROOT -AIPASS_HOME = Path.home() - -SYSTEM_LOGS_DIR = AIPASS_HOME / "system_logs" +SYSTEM_LOGS_DIR = TRIGGER_ROOT.parent / "system_logs" TRIGGER_DATA_FILE = TRIGGER_ROOT / "trigger_json" / "trigger_data.json" SUPPRESSED_LOG = TRIGGER_ROOT / "logs" / "medic_suppressed.log" diff --git a/src/aipass/trigger/apps/handlers/events/warning_logged.py b/src/aipass/trigger/apps/handlers/events/warning_logged.py index ce7df42e..58694628 100644 --- a/src/aipass/trigger/apps/handlers/events/warning_logged.py +++ b/src/aipass/trigger/apps/handlers/events/warning_logged.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/trigger/apps/handlers/json/json_handler.py b/src/aipass/trigger/apps/handlers/json/json_handler.py index 1ad9b27d..22affe7b 100644 --- a/src/aipass/trigger/apps/handlers/json/json_handler.py +++ b/src/aipass/trigger/apps/handlers/json/json_handler.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -257,7 +256,7 @@ if __name__ == "__main__": update_data_metrics("trigger", test_metric="working") console.print() - console.print("[green]Check /home/aipass/aipass_core/trigger/trigger_json/ for created files:[/green]") + console.print("[green]Check trigger/trigger_json/ for created files:[/green]") console.print(" [dim]•[/dim] trigger_config.json") console.print(" [dim]•[/dim] trigger_data.json") console.print(" [dim]•[/dim] trigger_log.json") diff --git a/src/aipass/trigger/apps/handlers/log_watcher.py b/src/aipass/trigger/apps/handlers/log_watcher.py index 8881203c..35f247a3 100644 --- a/src/aipass/trigger/apps/handlers/log_watcher.py +++ b/src/aipass/trigger/apps/handlers/log_watcher.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -34,8 +33,8 @@ Also watches ~/system_logs/ for system-level services. Fires error_detected events for the Trigger event system. Architecture: - - Watches: /home/aipass/aipass_core/*/logs/*.log - - Watches: /home/aipass/system_logs/*.log (mapped to owning branch) + - Watches: src/aipass/*/logs/*.log (branch log directories) + - Watches: system_logs/*.log (mapped to owning branch) - Parses: Prax format (timestamp | module | LEVEL | message) - Fires: error_detected event (via callback, branch=..., module=..., message=..., log_path=...) - Primary dedup: error_registry.report() with SHA1 fingerprinting (Medic v2) @@ -51,8 +50,6 @@ from pathlib import Path from typing import Any, Dict, Set, Optional, Callable from aipass.trigger.apps.config import TRIGGER_ROOT, AIPASS_PKG_ROOT -AIPASS_HOME = Path.home() - from aipass.prax.apps.modules.logger import get_direct_logger logger = get_direct_logger() @@ -121,7 +118,7 @@ SYSTEM_LOGS_BRANCH_MAP: Dict[str, str] = { 'telegram_chats.log': 'API', } -SYSTEM_LOGS_DIR = AIPASS_HOME / "system_logs" +SYSTEM_LOGS_DIR = AIPASS_PKG_ROOT.parent.parent / "system_logs" # Known branch prefixes that appear in system_logs filenames (_.log). # Sorted longest-first so "MEMORY_BANK" matches before "MEMORY", "backup_system" before "backup", etc. @@ -275,9 +272,9 @@ def _detect_branch_from_path(log_path: str) -> str: Detect branch name from log file path. Handles two path patterns: - - /home/aipass/aipass_core//logs/.log - - /home/aipass/system_logs/.log (mapped via SYSTEM_LOGS_BRANCH_MAP, - falls back to branch prefix in filename like "api_api.log" → API) + - src/aipass//logs/.log + - system_logs/.log (mapped via SYSTEM_LOGS_BRANCH_MAP, + falls back to branch prefix in filename like "api_api.log" -> API) Args: log_path: Full path to log file @@ -301,11 +298,13 @@ def _detect_branch_from_path(log_path: str) -> str: return prefix.upper() return 'UNKNOWN' - # Standard aipass_core//logs/ pattern + # Standard src/aipass//logs/ pattern parts = path.parts for i, part in enumerate(parts): - if part == 'aipass_core' and i + 1 < len(parts): - return parts[i + 1].upper() + if part == 'aipass' and i + 1 < len(parts) and parts[i + 1] != '__pycache__': + # Check if this looks like a branch dir (has logs/ subdir) + if i + 2 < len(parts) and parts[i + 2] == 'logs': + return parts[i + 1].upper() return 'UNKNOWN' except Exception: return 'UNKNOWN' @@ -414,7 +413,7 @@ class BranchLogWatcher(WatchdogFileSystemEventHandler if WATCHDOG_AVAILABLE else """ Watch branch log files and fire error_detected events. - Monitors /home/aipass/aipass_core/*/logs/*.log for ERROR entries. + Monitors src/aipass/*/logs/*.log for ERROR entries. Persists file positions to disk so restarts resume from last-processed offset. """ @@ -446,8 +445,8 @@ class BranchLogWatcher(WatchdogFileSystemEventHandler if WATCHDOG_AVAILABLE else if filename.lower() in _EXCLUDED_LOG_FILES_LOWER: return - # Only process branch logs (aipass_core/*/logs/) or system_logs/ - is_branch_log = '/aipass_core/' in file_path and '/logs/' in file_path + # Only process branch logs (aipass/*/logs/) or system_logs/ + is_branch_log = '/aipass/' in file_path and '/logs/' in file_path is_system_log = '/system_logs/' in file_path if not is_branch_log and not is_system_log: return @@ -596,12 +595,12 @@ class BranchLogWatcher(WatchdogFileSystemEventHandler if WATCHDOG_AVAILABLE else Loads saved positions from trigger_data.json first (survives restarts). For files not in persisted state, snaps to current EOF. Validates persisted positions against actual file sizes (handles rotation). - Covers both aipass_core/*/logs/ and system_logs/. + Covers both aipass/*/logs/ and system_logs/. """ # Load persisted positions from disk first persisted = _load_log_positions() - # Branch logs under aipass_core/*/logs/ + # Branch logs under aipass/*/logs/ for branch_dir in AIPASS_PKG_ROOT.iterdir(): if not branch_dir.is_dir(): continue @@ -640,7 +639,7 @@ def start_branch_log_watcher() -> Any: """ Start the branch log watcher. - Watches /home/aipass/aipass_core/*/logs/*.log for ERROR entries. + Watches src/aipass/*/logs/*.log for ERROR entries. Loads persisted positions from disk so restarts resume correctly. Returns: diff --git a/src/aipass/trigger/apps/handlers/medic_state.py b/src/aipass/trigger/apps/handlers/medic_state.py index e845e539..899e3bdc 100644 --- a/src/aipass/trigger/apps/handlers/medic_state.py +++ b/src/aipass/trigger/apps/handlers/medic_state.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/trigger/apps/handlers/watchers/log_watcher.py b/src/aipass/trigger/apps/handlers/watchers/log_watcher.py index 173ce838..55548c86 100644 --- a/src/aipass/trigger/apps/handlers/watchers/log_watcher.py +++ b/src/aipass/trigger/apps/handlers/watchers/log_watcher.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -20,7 +19,7 @@ """ Centralized Log Watcher - Trigger owns all log event detection -Watches /home/aipass/system_logs for log file changes. +Watches system_logs/ for log file changes. Detects ERROR/WARNING/INFO entries and fires appropriate events. Events fired: @@ -41,13 +40,12 @@ from datetime import datetime from pathlib import Path from typing import Dict, Any -AIPASS_HOME = Path.home() - # Logger - use standard logging to avoid circular imports with Prax logger = logging.getLogger(__name__) -# System logs directory -SYSTEM_LOGS_DIR = AIPASS_HOME / "system_logs" +# System logs directory (package-relative via config) +from aipass.trigger.apps.config import TRIGGER_ROOT +SYSTEM_LOGS_DIR = TRIGGER_ROOT.parent.parent / "system_logs" # Try to import watchdog try: diff --git a/src/aipass/trigger/apps/modules/branch_log_events.py b/src/aipass/trigger/apps/modules/branch_log_events.py index a8219c92..76ec1d57 100644 --- a/src/aipass/trigger/apps/modules/branch_log_events.py +++ b/src/aipass/trigger/apps/modules/branch_log_events.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -20,7 +19,7 @@ Branch Log Events Module - Public API for branch log watching Provides start/stop/status commands for the branch log watcher. -Watches /home/aipass/aipass_core/*/logs/*.log for ERROR entries. +Watches src/aipass/*/logs/*.log for ERROR entries. Fires error_detected events handled by AI_Mail's error_handler. Commands: start, stop, status @@ -49,7 +48,7 @@ def start() -> bool: """ Start the branch log watcher. - Watches /home/aipass/aipass_core/*/logs/*.log for ERROR entries. + Watches src/aipass/*/logs/*.log for ERROR entries. Fires error_detected events to registered handlers. Returns: diff --git a/src/aipass/trigger/apps/modules/core.py b/src/aipass/trigger/apps/modules/core.py index 661619df..f9dcd8be 100644 --- a/src/aipass/trigger/apps/modules/core.py +++ b/src/aipass/trigger/apps/modules/core.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -46,7 +45,7 @@ def _get_caller() -> str: # Try to get branch/module name parts = path.parts for i, part in enumerate(parts): - if part in ('aipass_core', 'MEMORY_BANK'): + if part == 'aipass': if i + 1 < len(parts): return parts[i + 1] # Return branch name return path.stem # Fallback to filename diff --git a/src/aipass/trigger/apps/modules/errors.py b/src/aipass/trigger/apps/modules/errors.py index ae919e35..986830f8 100644 --- a/src/aipass/trigger/apps/modules/errors.py +++ b/src/aipass/trigger/apps/modules/errors.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/trigger/apps/modules/log_events.py b/src/aipass/trigger/apps/modules/log_events.py index 88084ba2..38f359e3 100644 --- a/src/aipass/trigger/apps/modules/log_events.py +++ b/src/aipass/trigger/apps/modules/log_events.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -45,7 +44,7 @@ def start() -> bool: """ Start the centralized log watcher. - Watches /home/aipass/system_logs for log file changes. + Watches system_logs/ for log file changes. Fires error_logged and warning_logged events. Returns: diff --git a/src/aipass/trigger/apps/modules/medic.py b/src/aipass/trigger/apps/modules/medic.py index b1c98674..b4472de2 100644 --- a/src/aipass/trigger/apps/modules/medic.py +++ b/src/aipass/trigger/apps/modules/medic.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -82,7 +81,7 @@ def _extract_branch_name(raw: str) -> str: Extract branch name from raw argument. Handles both direct names (@speakeasy, speakeasy) and - drone-resolved paths (/home/aipass/aipass_core/speakeasy). + drone-resolved paths (e.g., src/aipass/speakeasy). Args: raw: Raw argument from command line diff --git a/src/aipass/trigger/apps/trigger.py b/src/aipass/trigger/apps/trigger.py index ce71122c..96c37020 100644 --- a/src/aipass/trigger/apps/trigger.py +++ b/src/aipass/trigger/apps/trigger.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER @@ -63,7 +62,7 @@ def discover_modules() -> List[Any]: if file_path.name.startswith("_"): continue - module_name = f"trigger.apps.modules.{file_path.stem}" + module_name = f"aipass.trigger.apps.modules.{file_path.stem}" try: module = importlib.import_module(module_name) diff --git a/src/aipass/trigger/tests/conftest.py b/src/aipass/trigger/tests/conftest.py index a87088fd..3cccc54b 100644 --- a/src/aipass/trigger/tests/conftest.py +++ b/src/aipass/trigger/tests/conftest.py @@ -1,4 +1,3 @@ -#!/home/aipass/.venv/bin/python3 # ===================AIPASS==================== # META DATA HEADER diff --git a/src/aipass/trigger/trigger_json/trigger_data.json b/src/aipass/trigger/trigger_json/trigger_data.json index 4af9c15b..ab017b33 100644 --- a/src/aipass/trigger/trigger_json/trigger_data.json +++ b/src/aipass/trigger/trigger_json/trigger_data.json @@ -1,14 +1,14 @@ { "error_catchup": { - "last_scan_timestamp": "2026-03-06T11:35:03.559262", + "last_scan_timestamp": "2026-03-06T20:38:05.532132", "processed_hashes": [ + "68dd0ab6", "4095ef97", "02d93909", - "69de737b", "541e0b9b", + "69de737b", "ace01637", - "c7edc03b", - "68dd0ab6" + "c7edc03b" ], "max_hashes": 500, "max_lookback_hours": 24 diff --git a/system_logs/ai_mail_ai_mail.log b/system_logs/ai_mail_ai_mail.log new file mode 100644 index 00000000..b01f0233 --- /dev/null +++ b/system_logs/ai_mail_ai_mail.log @@ -0,0 +1,35 @@ +2026-03-06 19:26:01 - captured_ai_mail - INFO - [ai_mail] Discovering modules... +2026-03-06 19:26:01 - captured_ai_mail - ERROR - [-] aipass.ai_mail.apps.modules.email - import error: No module named 'aipass.dev_central' +2026-03-06 19:26:01 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.dispatch +2026-03-06 19:26:01 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.branch_ping +2026-03-06 19:26:01 - captured_ai_mail - INFO - [ai_mail] Discovered 2 modules +2026-03-06 19:26:27 - captured_ai_mail - INFO - [ai_mail] Discovering modules... +2026-03-06 19:26:27 - captured_ai_mail - ERROR - [-] aipass.ai_mail.apps.modules.email - import error: No module named 'aipass.dev_central' +2026-03-06 19:26:27 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.dispatch +2026-03-06 19:26:27 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.branch_ping +2026-03-06 19:26:27 - captured_ai_mail - INFO - [ai_mail] Discovered 2 modules +2026-03-06 20:32:14 - captured_ai_mail - INFO - [ai_mail] Discovering modules... +2026-03-06 20:32:14 - captured_ai_mail - ERROR - [-] aipass.ai_mail.apps.modules.email - import error: No module named 'aipass.dev_central' +2026-03-06 20:32:14 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.dispatch +2026-03-06 20:32:14 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.branch_ping +2026-03-06 20:32:14 - captured_ai_mail - INFO - [ai_mail] Discovered 2 modules +2026-03-06 20:32:37 - captured_ai_mail - INFO - [ai_mail] Discovering modules... +2026-03-06 20:32:37 - captured_ai_mail - ERROR - [-] aipass.ai_mail.apps.modules.email - import error: No module named 'aipass.dev_central' +2026-03-06 20:32:37 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.dispatch +2026-03-06 20:32:37 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.branch_ping +2026-03-06 20:32:37 - captured_ai_mail - INFO - [ai_mail] Discovered 2 modules +2026-03-06 20:32:42 - captured_ai_mail - INFO - [ai_mail] Discovering modules... +2026-03-06 20:32:42 - captured_ai_mail - ERROR - [-] aipass.ai_mail.apps.modules.email - import error: No module named 'aipass.dev_central' +2026-03-06 20:32:42 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.dispatch +2026-03-06 20:32:42 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.branch_ping +2026-03-06 20:32:42 - captured_ai_mail - INFO - [ai_mail] Discovered 2 modules +2026-03-06 20:33:19 - captured_ai_mail - INFO - [ai_mail] Discovering modules... +2026-03-06 20:33:19 - captured_ai_mail - ERROR - [-] aipass.ai_mail.apps.modules.email - import error: No module named 'aipass.dev_central' +2026-03-06 20:33:19 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.dispatch +2026-03-06 20:33:19 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.branch_ping +2026-03-06 20:33:19 - captured_ai_mail - INFO - [ai_mail] Discovered 2 modules +2026-03-06 20:33:19 - captured_ai_mail - INFO - [ai_mail] Discovering modules... +2026-03-06 20:33:19 - captured_ai_mail - ERROR - [-] aipass.ai_mail.apps.modules.email - import error: No module named 'aipass.dev_central' +2026-03-06 20:33:19 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.dispatch +2026-03-06 20:33:19 - captured_ai_mail - INFO - [+] aipass.ai_mail.apps.modules.branch_ping +2026-03-06 20:33:19 - captured_ai_mail - INFO - [ai_mail] Discovered 2 modules diff --git a/system_logs/ai_mail_dispatch.log b/system_logs/ai_mail_dispatch.log new file mode 100644 index 00000000..58f0a13f --- /dev/null +++ b/system_logs/ai_mail_dispatch.log @@ -0,0 +1 @@ +2026-03-06 20:33:19 - captured_dispatch - INFO - [dispatch] Showing dispatch status diff --git a/system_logs/api_api.log b/system_logs/api_api.log new file mode 100644 index 00000000..85218703 --- /dev/null +++ b/system_logs/api_api.log @@ -0,0 +1,29 @@ +2026-03-06 19:25:57 - captured_api - INFO - [api] Discovering modules... +2026-03-06 19:25:57 - captured_api - INFO - [+] telegram_service +2026-03-06 19:25:57 - captured_api - INFO - [+] telegram_bot +2026-03-06 19:25:57 - captured_api - INFO - [+] api_key +2026-03-06 19:25:57 - captured_api - ERROR - [-] openrouter_client - import error: name 'OpenAI' is not defined +2026-03-06 19:25:57 - captured_api - INFO - [+] usage_tracker +2026-03-06 19:25:57 - captured_api - INFO - [api] Discovered 4 modules +2026-03-06 19:25:57 - captured_api - WARNING - Unknown command: test +2026-03-06 19:26:31 - captured_api - INFO - [api] Discovering modules... +2026-03-06 19:26:31 - captured_api - INFO - [+] telegram_service +2026-03-06 19:26:31 - captured_api - INFO - [+] telegram_bot +2026-03-06 19:26:31 - captured_api - INFO - [+] api_key +2026-03-06 19:26:31 - captured_api - ERROR - [-] openrouter_client - import error: name 'OpenAI' is not defined +2026-03-06 19:26:31 - captured_api - INFO - [+] usage_tracker +2026-03-06 19:26:31 - captured_api - INFO - [api] Discovered 4 modules +2026-03-06 19:26:38 - captured_api - INFO - [api] Discovering modules... +2026-03-06 19:26:38 - captured_api - INFO - [+] telegram_service +2026-03-06 19:26:38 - captured_api - INFO - [+] telegram_bot +2026-03-06 19:26:38 - captured_api - INFO - [+] api_key +2026-03-06 19:26:38 - captured_api - ERROR - [-] openrouter_client - import error: name 'OpenAI' is not defined +2026-03-06 19:26:38 - captured_api - INFO - [+] usage_tracker +2026-03-06 19:26:38 - captured_api - INFO - [api] Discovered 4 modules +2026-03-06 19:26:41 - captured_api - INFO - [api] Discovering modules... +2026-03-06 19:26:41 - captured_api - INFO - [+] telegram_service +2026-03-06 19:26:41 - captured_api - INFO - [+] telegram_bot +2026-03-06 19:26:41 - captured_api - INFO - [+] api_key +2026-03-06 19:26:41 - captured_api - ERROR - [-] openrouter_client - import error: name 'OpenAI' is not defined +2026-03-06 19:26:41 - captured_api - INFO - [+] usage_tracker +2026-03-06 19:26:41 - captured_api - INFO - [api] Discovered 4 modules diff --git a/system_logs/flow_aggregate_central.log b/system_logs/flow_aggregate_central.log new file mode 100644 index 00000000..16772a69 --- /dev/null +++ b/system_logs/flow_aggregate_central.log @@ -0,0 +1,6 @@ +2026-03-06 19:26:45 - captured_aggregate_central - INFO - [aggregate_central] Starting central aggregation +2026-03-06 19:26:45 - captured_aggregate_central - INFO - [aggregate_central] Processing branch: flow +2026-03-06 19:26:45 - captured_aggregate_central - INFO - [aggregate_central] SUCCESS: Aggregation complete: 0 active, 0 recently closed +2026-03-06 20:20:39 - captured_aggregate_central - INFO - [aggregate_central] Starting central aggregation +2026-03-06 20:20:39 - captured_aggregate_central - INFO - [aggregate_central] Processing branch: flow +2026-03-06 20:20:39 - captured_aggregate_central - INFO - [aggregate_central] SUCCESS: Aggregation complete: 1 active, 0 recently closed diff --git a/system_logs/flow_close_plan.log b/system_logs/flow_close_plan.log new file mode 100644 index 00000000..f2bdde1a --- /dev/null +++ b/system_logs/flow_close_plan.log @@ -0,0 +1,4 @@ +2026-03-06 19:26:52 - captured_close_plan - INFO - [close_plan] Deleted empty template file: /tmp/FPLAN-0001_test_plan_from_devpulse_2026-03-06.md +2026-03-06 19:26:52 - captured_close_plan - INFO - [close_plan] Removed FPLAN-0001 from registry +2026-03-06 20:21:02 - captured_close_plan - INFO - [close_plan] Deleted empty template file: /home/coder/workspace/src/aipass/flow/FPLAN-0002_2026-03-06.md +2026-03-06 20:21:02 - captured_close_plan - INFO - [close_plan] Removed FPLAN-0002 from registry diff --git a/system_logs/flow_create_plan.log b/system_logs/flow_create_plan.log new file mode 100644 index 00000000..5a9510b1 --- /dev/null +++ b/system_logs/flow_create_plan.log @@ -0,0 +1,2 @@ +2026-03-06 19:26:45 - captured_create_plan - INFO - [create_plan] Created FPLAN-0001 in /tmp +2026-03-06 20:20:39 - captured_create_plan - INFO - [create_plan] Created FPLAN-0002 in flow diff --git a/system_logs/flow_flow.log b/system_logs/flow_flow.log new file mode 100644 index 00000000..ddf35a1b --- /dev/null +++ b/system_logs/flow_flow.log @@ -0,0 +1,77 @@ +2026-03-06 19:25:13 - captured_flow - INFO - [FLOW] Skipped post_close_runner - no handle_command() +2026-03-06 19:25:13 - captured_flow - INFO - [FLOW] Loaded module: aggregate_central +2026-03-06 19:25:13 - captured_flow - INFO - [FLOW] Loaded module: registry_monitor +2026-03-06 19:25:13 - captured_flow - INFO - [FLOW] Loaded module: restore_plan +2026-03-06 19:25:13 - captured_flow - INFO - [FLOW] Loaded module: list_plans +2026-03-06 19:25:13 - captured_flow - INFO - [FLOW] Loaded module: close_plan +2026-03-06 19:25:13 - captured_flow - INFO - [FLOW] Loaded module: create_plan +2026-03-06 19:25:53 - captured_flow - INFO - [FLOW] Skipped post_close_runner - no handle_command() +2026-03-06 19:25:53 - captured_flow - INFO - [FLOW] Loaded module: aggregate_central +2026-03-06 19:25:53 - captured_flow - INFO - [FLOW] Loaded module: registry_monitor +2026-03-06 19:25:53 - captured_flow - INFO - [FLOW] Loaded module: restore_plan +2026-03-06 19:25:53 - captured_flow - INFO - [FLOW] Loaded module: list_plans +2026-03-06 19:25:53 - captured_flow - INFO - [FLOW] Loaded module: close_plan +2026-03-06 19:25:53 - captured_flow - INFO - [FLOW] Loaded module: create_plan +2026-03-06 19:26:45 - captured_flow - INFO - [FLOW] Skipped post_close_runner - no handle_command() +2026-03-06 19:26:45 - captured_flow - INFO - [FLOW] Loaded module: aggregate_central +2026-03-06 19:26:45 - captured_flow - INFO - [FLOW] Loaded module: registry_monitor +2026-03-06 19:26:45 - captured_flow - INFO - [FLOW] Loaded module: restore_plan +2026-03-06 19:26:45 - captured_flow - INFO - [FLOW] Loaded module: list_plans +2026-03-06 19:26:45 - captured_flow - INFO - [FLOW] Loaded module: close_plan +2026-03-06 19:26:45 - captured_flow - INFO - [FLOW] Loaded module: create_plan +2026-03-06 19:26:49 - captured_flow - INFO - [FLOW] Skipped post_close_runner - no handle_command() +2026-03-06 19:26:49 - captured_flow - INFO - [FLOW] Loaded module: aggregate_central +2026-03-06 19:26:49 - captured_flow - INFO - [FLOW] Loaded module: registry_monitor +2026-03-06 19:26:49 - captured_flow - INFO - [FLOW] Loaded module: restore_plan +2026-03-06 19:26:49 - captured_flow - INFO - [FLOW] Loaded module: list_plans +2026-03-06 19:26:49 - captured_flow - INFO - [FLOW] Loaded module: close_plan +2026-03-06 19:26:49 - captured_flow - INFO - [FLOW] Loaded module: create_plan +2026-03-06 19:26:52 - captured_flow - INFO - [FLOW] Skipped post_close_runner - no handle_command() +2026-03-06 19:26:52 - captured_flow - INFO - [FLOW] Loaded module: aggregate_central +2026-03-06 19:26:52 - captured_flow - INFO - [FLOW] Loaded module: registry_monitor +2026-03-06 19:26:52 - captured_flow - INFO - [FLOW] Loaded module: restore_plan +2026-03-06 19:26:52 - captured_flow - INFO - [FLOW] Loaded module: list_plans +2026-03-06 19:26:52 - captured_flow - INFO - [FLOW] Loaded module: close_plan +2026-03-06 19:26:52 - captured_flow - INFO - [FLOW] Loaded module: create_plan +2026-03-06 20:20:13 - captured_flow - INFO - [FLOW] Skipped post_close_runner - no handle_command() +2026-03-06 20:20:13 - captured_flow - INFO - [FLOW] Loaded module: aggregate_central +2026-03-06 20:20:13 - captured_flow - INFO - [FLOW] Loaded module: registry_monitor +2026-03-06 20:20:13 - captured_flow - INFO - [FLOW] Loaded module: restore_plan +2026-03-06 20:20:13 - captured_flow - INFO - [FLOW] Loaded module: list_plans +2026-03-06 20:20:13 - captured_flow - INFO - [FLOW] Loaded module: close_plan +2026-03-06 20:20:13 - captured_flow - INFO - [FLOW] Loaded module: create_plan +2026-03-06 20:20:22 - captured_flow - INFO - [FLOW] Skipped post_close_runner - no handle_command() +2026-03-06 20:20:22 - captured_flow - INFO - [FLOW] Loaded module: aggregate_central +2026-03-06 20:20:22 - captured_flow - INFO - [FLOW] Loaded module: registry_monitor +2026-03-06 20:20:22 - captured_flow - INFO - [FLOW] Loaded module: restore_plan +2026-03-06 20:20:22 - captured_flow - INFO - [FLOW] Loaded module: list_plans +2026-03-06 20:20:22 - captured_flow - INFO - [FLOW] Loaded module: close_plan +2026-03-06 20:20:22 - captured_flow - INFO - [FLOW] Loaded module: create_plan +2026-03-06 20:20:39 - captured_flow - INFO - [FLOW] Skipped post_close_runner - no handle_command() +2026-03-06 20:20:39 - captured_flow - INFO - [FLOW] Loaded module: aggregate_central +2026-03-06 20:20:39 - captured_flow - INFO - [FLOW] Loaded module: registry_monitor +2026-03-06 20:20:39 - captured_flow - INFO - [FLOW] Loaded module: restore_plan +2026-03-06 20:20:39 - captured_flow - INFO - [FLOW] Loaded module: list_plans +2026-03-06 20:20:39 - captured_flow - INFO - [FLOW] Loaded module: close_plan +2026-03-06 20:20:39 - captured_flow - INFO - [FLOW] Loaded module: create_plan +2026-03-06 20:21:02 - captured_flow - INFO - [FLOW] Skipped post_close_runner - no handle_command() +2026-03-06 20:21:02 - captured_flow - INFO - [FLOW] Loaded module: aggregate_central +2026-03-06 20:21:02 - captured_flow - INFO - [FLOW] Loaded module: registry_monitor +2026-03-06 20:21:02 - captured_flow - INFO - [FLOW] Loaded module: restore_plan +2026-03-06 20:21:02 - captured_flow - INFO - [FLOW] Loaded module: list_plans +2026-03-06 20:21:02 - captured_flow - INFO - [FLOW] Loaded module: close_plan +2026-03-06 20:21:02 - captured_flow - INFO - [FLOW] Loaded module: create_plan +2026-03-06 20:37:06 - captured_flow - INFO - [FLOW] Skipped post_close_runner - no handle_command() +2026-03-06 20:37:06 - captured_flow - INFO - [FLOW] Loaded module: aggregate_central +2026-03-06 20:37:06 - captured_flow - INFO - [FLOW] Loaded module: registry_monitor +2026-03-06 20:37:06 - captured_flow - INFO - [FLOW] Loaded module: restore_plan +2026-03-06 20:37:06 - captured_flow - INFO - [FLOW] Loaded module: list_plans +2026-03-06 20:37:06 - captured_flow - INFO - [FLOW] Loaded module: close_plan +2026-03-06 20:37:06 - captured_flow - INFO - [FLOW] Loaded module: create_plan +2026-03-06 20:38:04 - captured_flow - INFO - [FLOW] Skipped post_close_runner - no handle_command() +2026-03-06 20:38:04 - captured_flow - INFO - [FLOW] Loaded module: aggregate_central +2026-03-06 20:38:04 - captured_flow - INFO - [FLOW] Loaded module: registry_monitor +2026-03-06 20:38:04 - captured_flow - INFO - [FLOW] Loaded module: restore_plan +2026-03-06 20:38:04 - captured_flow - INFO - [FLOW] Loaded module: list_plans +2026-03-06 20:38:04 - captured_flow - INFO - [FLOW] Loaded module: close_plan +2026-03-06 20:38:04 - captured_flow - INFO - [FLOW] Loaded module: create_plan diff --git a/system_logs/flow_list_plans.log b/system_logs/flow_list_plans.log new file mode 100644 index 00000000..3aa9e8f2 --- /dev/null +++ b/system_logs/flow_list_plans.log @@ -0,0 +1,2 @@ +2026-03-06 19:25:53 - captured_list_plans - INFO - [list_plans] No plans in registry +2026-03-06 19:26:49 - captured_list_plans - INFO - [list_plans] Listed plans (filter: open) diff --git a/system_logs/prax_monitor_module.log b/system_logs/prax_monitor_module.log new file mode 100644 index 00000000..3194a590 --- /dev/null +++ b/system_logs/prax_monitor_module.log @@ -0,0 +1,2 @@ +2026-03-06 20:19:23 - captured_monitor_module - INFO - Starting unified monitoring (args: []) +2026-03-06 20:19:23 - captured_monitor_module - INFO - All monitoring threads started diff --git a/system_logs/prax_unknown_module.log b/system_logs/prax_unknown_module.log new file mode 100644 index 00000000..c3922564 --- /dev/null +++ b/system_logs/prax_unknown_module.log @@ -0,0 +1,2 @@ +2026-03-06 18:38:57 - captured_unknown_module - INFO - test +2026-03-06 18:39:46 - captured_unknown_module - INFO - DPLAN-047 Phase 2: Path portability fix verified diff --git a/system_logs/seedgo_seedgo_verify.log b/system_logs/seedgo_seedgo_verify.log new file mode 100644 index 00000000..367ee470 --- /dev/null +++ b/system_logs/seedgo_seedgo_verify.log @@ -0,0 +1 @@ +2026-03-06 19:24:36 - captured_seedgo_verify - INFO - Seedgo verify: 5/5 (100%) diff --git a/system_logs/seedgo_standards_checklist.log b/system_logs/seedgo_standards_checklist.log new file mode 100644 index 00000000..1cce6cb5 --- /dev/null +++ b/system_logs/seedgo_standards_checklist.log @@ -0,0 +1,78 @@ +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Starting standards compliance check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - ERROR - [standards_checklist] Error reading branch registry: name 'BRANCH_REGISTRY_PATH' is not defined +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running IMPORTS standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] IMPORTS check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running ARCHITECTURE standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] ARCHITECTURE check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running NAMING standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] NAMING check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running CLI standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] CLI check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running HANDLERS standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] HANDLERS check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running MODULES standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] MODULES check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running DOCUMENTATION standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] DOCUMENTATION check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running JSON_STRUCTURE standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] JSON_STRUCTURE check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running TESTING standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] TESTING check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running ERROR_HANDLING standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] ERROR_HANDLING check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running ENCAPSULATION standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] ENCAPSULATION check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running TRIGGER standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] TRIGGER check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running LOG_LEVEL standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] LOG_LEVEL check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running CLI_FLAGS standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] CLI_FLAGS check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running LOG_HANDLER standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] LOG_HANDLER check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running LOG_VISIBILITY standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] LOG_VISIBILITY check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running PERMISSION_FLAGS standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] PERMISSION_FLAGS check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Running SHEBANG standard check on src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] SHEBANG check complete: 0/100 +2026-03-06 19:25:42 - captured_standards_checklist - INFO - [standards_checklist] Standards check complete: 0% average compliance +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Starting standards compliance check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - ERROR - [standards_checklist] Error reading branch registry: name 'BRANCH_REGISTRY_PATH' is not defined +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running IMPORTS standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] IMPORTS check complete: 80/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running ARCHITECTURE standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] ARCHITECTURE check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running NAMING standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] NAMING check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running CLI standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] CLI check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running HANDLERS standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] HANDLERS check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running MODULES standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] MODULES check complete: 60/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running DOCUMENTATION standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] DOCUMENTATION check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running JSON_STRUCTURE standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] JSON_STRUCTURE check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running TESTING standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] TESTING check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running ERROR_HANDLING standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] ERROR_HANDLING check complete: 66/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running ENCAPSULATION standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] ENCAPSULATION check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running TRIGGER standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] TRIGGER check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running LOG_LEVEL standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] LOG_LEVEL check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running CLI_FLAGS standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] CLI_FLAGS check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running LOG_HANDLER standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] LOG_HANDLER check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running LOG_VISIBILITY standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] LOG_VISIBILITY check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running PERMISSION_FLAGS standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] PERMISSION_FLAGS check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Running SHEBANG standard check on /home/coder/workspace/src/aipass/drone/apps/modules/config.py +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] SHEBANG check complete: 100/100 +2026-03-06 19:25:46 - captured_standards_checklist - INFO - [standards_checklist] Standards check complete: 94% average compliance diff --git a/system_logs/trigger_core.log b/system_logs/trigger_core.log new file mode 100644 index 00000000..1fb9834e --- /dev/null +++ b/system_logs/trigger_core.log @@ -0,0 +1,128 @@ +2026-03-06 18:38:57 - captured_core - INFO - [TRIGGER] logger fired: startup +2026-03-06 18:38:57 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 18:39:46 - captured_core - INFO - [TRIGGER] logger fired: startup +2026-03-06 18:39:46 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:02:03 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:02:03 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:24:36 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:24:36 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:24:39 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:24:39 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:24:49 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:24:49 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:25:09 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:25:09 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:25:13 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:25:13 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:25:13 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:25:13 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:25:21 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:25:21 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:25:21 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:25:21 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:25:27 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:25:27 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:25:42 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:25:42 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:25:42 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:25:42 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:25:46 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:25:46 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:25:46 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:25:46 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:25:53 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:25:53 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:25:57 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:25:57 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:26:01 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:26:01 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:26:07 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:26:07 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:26:27 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:26:27 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:26:31 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:26:31 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:26:31 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:26:31 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:26:38 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:26:38 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:26:38 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:26:38 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:26:41 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:26:41 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:26:41 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:26:41 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:26:45 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:26:45 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:26:45 - captured_core - INFO - [TRIGGER] flow fired: central_aggregated +2026-03-06 19:26:45 - captured_core - INFO - [TRIGGER] 0 handlers responding +2026-03-06 19:26:45 - captured_core - INFO - [TRIGGER] flow fired: plan_created +2026-03-06 19:26:45 - captured_core - INFO - [TRIGGER] 0 handlers responding +2026-03-06 19:26:49 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:26:49 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:26:52 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:26:52 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:53:58 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:53:58 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:53:58 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:53:58 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:53:58 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:53:58 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:55:03 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:55:03 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:55:03 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:55:03 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:19:23 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:19:23 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:19:23 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 20:19:23 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:20:13 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:20:13 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:20:22 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:20:22 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:20:22 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 20:20:22 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:20:39 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:20:39 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:20:39 - captured_core - INFO - [TRIGGER] flow fired: central_aggregated +2026-03-06 20:20:39 - captured_core - INFO - [TRIGGER] 0 handlers responding +2026-03-06 20:20:39 - captured_core - INFO - [TRIGGER] flow fired: plan_created +2026-03-06 20:20:39 - captured_core - INFO - [TRIGGER] 0 handlers responding +2026-03-06 20:21:02 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:21:02 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:32:14 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:32:14 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:32:37 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:32:37 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:32:42 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:32:42 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:33:19 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:33:19 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:33:19 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:33:19 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:37:06 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 20:37:06 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:37:06 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:37:06 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:37:06 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 20:37:06 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:37:07 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 20:37:07 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:37:07 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:37:07 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:37:07 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 20:37:07 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:38:03 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 20:38:03 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:38:04 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:38:04 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:38:04 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 20:38:04 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:38:04 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 20:38:04 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:38:05 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:38:05 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:38:05 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 20:38:05 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:38:05 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 20:38:05 - captured_core - INFO - [TRIGGER] 1 handlers responding diff --git a/system_logs/trigger_trigger.log b/system_logs/trigger_trigger.log new file mode 100644 index 00000000..6e5017a5 --- /dev/null +++ b/system_logs/trigger_trigger.log @@ -0,0 +1,35 @@ +2026-03-06 19:25:21 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.medic: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:25:21 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.errors: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:25:21 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.branch_log_events: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:25:21 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.core: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:25:21 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.log_events: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:26:07 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.medic: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:26:07 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.errors: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:26:07 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.branch_log_events: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:26:07 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.core: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:26:07 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.log_events: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:53:58 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.medic: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:53:58 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.errors: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:53:58 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.branch_log_events: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:53:58 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.core: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:53:58 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.log_events: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:53:58 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.medic: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:53:58 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.errors: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:53:58 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.branch_log_events: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:53:58 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.core: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:53:58 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.log_events: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:55:03 - captured_trigger - INFO - [TRIGGER] Loaded module: medic +2026-03-06 19:55:03 - captured_trigger - INFO - [TRIGGER] Loaded module: errors +2026-03-06 19:55:03 - captured_trigger - INFO - [TRIGGER] Loaded module: branch_log_events +2026-03-06 19:55:03 - captured_trigger - INFO - [TRIGGER] Skipped core - no handle_command() +2026-03-06 19:55:03 - captured_trigger - INFO - [TRIGGER] Loaded module: log_events +2026-03-06 20:37:07 - captured_trigger - INFO - [TRIGGER] Loaded module: medic +2026-03-06 20:37:07 - captured_trigger - INFO - [TRIGGER] Loaded module: errors +2026-03-06 20:37:07 - captured_trigger - INFO - [TRIGGER] Loaded module: branch_log_events +2026-03-06 20:37:07 - captured_trigger - INFO - [TRIGGER] Skipped core - no handle_command() +2026-03-06 20:37:07 - captured_trigger - INFO - [TRIGGER] Loaded module: log_events +2026-03-06 20:38:05 - captured_trigger - INFO - [TRIGGER] Loaded module: medic +2026-03-06 20:38:05 - captured_trigger - INFO - [TRIGGER] Loaded module: errors +2026-03-06 20:38:05 - captured_trigger - INFO - [TRIGGER] Loaded module: branch_log_events +2026-03-06 20:38:05 - captured_trigger - INFO - [TRIGGER] Skipped core - no handle_command() +2026-03-06 20:38:05 - captured_trigger - INFO - [TRIGGER] Loaded module: log_events diff --git a/trigger/logs/core.log b/trigger/logs/core.log new file mode 100644 index 00000000..1fb9834e --- /dev/null +++ b/trigger/logs/core.log @@ -0,0 +1,128 @@ +2026-03-06 18:38:57 - captured_core - INFO - [TRIGGER] logger fired: startup +2026-03-06 18:38:57 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 18:39:46 - captured_core - INFO - [TRIGGER] logger fired: startup +2026-03-06 18:39:46 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:02:03 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:02:03 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:24:36 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:24:36 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:24:39 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:24:39 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:24:49 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:24:49 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:25:09 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:25:09 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:25:13 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:25:13 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:25:13 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:25:13 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:25:21 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:25:21 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:25:21 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:25:21 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:25:27 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:25:27 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:25:42 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:25:42 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:25:42 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:25:42 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:25:46 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:25:46 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:25:46 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:25:46 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:25:53 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:25:53 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:25:57 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:25:57 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:26:01 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:26:01 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:26:07 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:26:07 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:26:27 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:26:27 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:26:31 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:26:31 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:26:31 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:26:31 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:26:38 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:26:38 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:26:38 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:26:38 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:26:41 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:26:41 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:26:41 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:26:41 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:26:45 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:26:45 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:26:45 - captured_core - INFO - [TRIGGER] flow fired: central_aggregated +2026-03-06 19:26:45 - captured_core - INFO - [TRIGGER] 0 handlers responding +2026-03-06 19:26:45 - captured_core - INFO - [TRIGGER] flow fired: plan_created +2026-03-06 19:26:45 - captured_core - INFO - [TRIGGER] 0 handlers responding +2026-03-06 19:26:49 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:26:49 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:26:52 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:26:52 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:53:58 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:53:58 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:53:58 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:53:58 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:53:58 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:53:58 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:55:03 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 19:55:03 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 19:55:03 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 19:55:03 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:19:23 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:19:23 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:19:23 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 20:19:23 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:20:13 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:20:13 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:20:22 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:20:22 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:20:22 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 20:20:22 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:20:39 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:20:39 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:20:39 - captured_core - INFO - [TRIGGER] flow fired: central_aggregated +2026-03-06 20:20:39 - captured_core - INFO - [TRIGGER] 0 handlers responding +2026-03-06 20:20:39 - captured_core - INFO - [TRIGGER] flow fired: plan_created +2026-03-06 20:20:39 - captured_core - INFO - [TRIGGER] 0 handlers responding +2026-03-06 20:21:02 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:21:02 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:32:14 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:32:14 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:32:37 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:32:37 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:32:42 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:32:42 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:33:19 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:33:19 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:33:19 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:33:19 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:37:06 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 20:37:06 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:37:06 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:37:06 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:37:06 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 20:37:06 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:37:07 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 20:37:07 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:37:07 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:37:07 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:37:07 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 20:37:07 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:38:03 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 20:38:03 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:38:04 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:38:04 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:38:04 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 20:38:04 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:38:04 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 20:38:04 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:38:05 - captured_core - INFO - [TRIGGER] prax fired: startup +2026-03-06 20:38:05 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:38:05 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 20:38:05 - captured_core - INFO - [TRIGGER] 1 handlers responding +2026-03-06 20:38:05 - captured_core - INFO - [TRIGGER] cli fired: cli_header_displayed +2026-03-06 20:38:05 - captured_core - INFO - [TRIGGER] 1 handlers responding diff --git a/trigger/logs/trigger.log b/trigger/logs/trigger.log new file mode 100644 index 00000000..6e5017a5 --- /dev/null +++ b/trigger/logs/trigger.log @@ -0,0 +1,35 @@ +2026-03-06 19:25:21 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.medic: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:25:21 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.errors: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:25:21 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.branch_log_events: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:25:21 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.core: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:25:21 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.log_events: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:26:07 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.medic: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:26:07 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.errors: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:26:07 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.branch_log_events: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:26:07 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.core: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:26:07 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.log_events: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:53:58 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.medic: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:53:58 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.errors: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:53:58 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.branch_log_events: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:53:58 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.core: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:53:58 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.log_events: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:53:58 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.medic: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:53:58 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.errors: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:53:58 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.branch_log_events: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:53:58 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.core: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:53:58 - captured_trigger - ERROR - [TRIGGER] Failed to load module trigger.apps.modules.log_events: No module named 'trigger.apps'; 'trigger' is not a package +2026-03-06 19:55:03 - captured_trigger - INFO - [TRIGGER] Loaded module: medic +2026-03-06 19:55:03 - captured_trigger - INFO - [TRIGGER] Loaded module: errors +2026-03-06 19:55:03 - captured_trigger - INFO - [TRIGGER] Loaded module: branch_log_events +2026-03-06 19:55:03 - captured_trigger - INFO - [TRIGGER] Skipped core - no handle_command() +2026-03-06 19:55:03 - captured_trigger - INFO - [TRIGGER] Loaded module: log_events +2026-03-06 20:37:07 - captured_trigger - INFO - [TRIGGER] Loaded module: medic +2026-03-06 20:37:07 - captured_trigger - INFO - [TRIGGER] Loaded module: errors +2026-03-06 20:37:07 - captured_trigger - INFO - [TRIGGER] Loaded module: branch_log_events +2026-03-06 20:37:07 - captured_trigger - INFO - [TRIGGER] Skipped core - no handle_command() +2026-03-06 20:37:07 - captured_trigger - INFO - [TRIGGER] Loaded module: log_events +2026-03-06 20:38:05 - captured_trigger - INFO - [TRIGGER] Loaded module: medic +2026-03-06 20:38:05 - captured_trigger - INFO - [TRIGGER] Loaded module: errors +2026-03-06 20:38:05 - captured_trigger - INFO - [TRIGGER] Loaded module: branch_log_events +2026-03-06 20:38:05 - captured_trigger - INFO - [TRIGGER] Skipped core - no handle_command() +2026-03-06 20:38:05 - captured_trigger - INFO - [TRIGGER] Loaded module: log_events