@fuzdev/fuz_app 0.150.0 → 0.151.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/actions/CLAUDE.md +324 -299
- package/dist/actions/action_bridge.d.ts +5 -86
- package/dist/actions/action_bridge.d.ts.map +1 -1
- package/dist/actions/action_bridge.js +4 -84
- package/dist/actions/action_codegen.d.ts +8 -166
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +19 -95
- package/dist/actions/action_dispatcher.d.ts +10 -0
- package/dist/actions/action_dispatcher.d.ts.map +1 -1
- package/dist/actions/action_dispatcher.js +9 -6
- package/dist/actions/action_event.d.ts +1 -2
- package/dist/actions/action_event.d.ts.map +1 -1
- package/dist/actions/action_event.js +7 -13
- package/dist/actions/action_event_helpers.d.ts +1 -40
- package/dist/actions/action_event_helpers.d.ts.map +1 -1
- package/dist/actions/action_event_helpers.js +1 -25
- package/dist/actions/action_rpc.d.ts +10 -215
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +56 -111
- package/dist/actions/action_spec.d.ts +2 -2
- package/dist/actions/action_spec.js +2 -2
- package/dist/actions/action_types.d.ts +229 -8
- package/dist/actions/action_types.d.ts.map +1 -1
- package/dist/actions/action_types.js +56 -5
- package/dist/actions/broadcast_api.d.ts +22 -17
- package/dist/actions/broadcast_api.d.ts.map +1 -1
- package/dist/actions/broadcast_api.js +16 -27
- package/dist/actions/cancel.d.ts +4 -13
- package/dist/actions/cancel.d.ts.map +1 -1
- package/dist/actions/cancel.js +5 -17
- package/dist/actions/compile_action_registry.d.ts +1 -2
- package/dist/actions/compile_action_registry.d.ts.map +1 -1
- package/dist/actions/connection_closer.d.ts +120 -50
- package/dist/actions/connection_closer.d.ts.map +1 -1
- package/dist/actions/connection_closer.js +139 -31
- package/dist/actions/{transports_ws_backend.d.ts → connection_registry.d.ts} +120 -132
- package/dist/actions/connection_registry.d.ts.map +1 -0
- package/dist/actions/{transports_ws_backend.js → connection_registry.js} +149 -152
- package/dist/actions/frontend_rpc_client.d.ts +52 -2
- package/dist/actions/frontend_rpc_client.d.ts.map +1 -1
- package/dist/actions/frontend_rpc_client.js +42 -4
- package/dist/actions/peer_ping.d.ts +7 -9
- package/dist/actions/peer_ping.d.ts.map +1 -1
- package/dist/actions/peer_ping.js +6 -8
- package/dist/actions/peer_request.d.ts +6 -5
- package/dist/actions/peer_request.d.ts.map +1 -1
- package/dist/actions/peer_request.js +6 -5
- package/dist/actions/perform_action.d.ts +36 -28
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +60 -34
- package/dist/actions/protocol.d.ts +14 -0
- package/dist/actions/protocol.d.ts.map +1 -1
- package/dist/actions/protocol.js +18 -0
- package/dist/actions/register_action_ws.d.ts +137 -298
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +155 -923
- package/dist/actions/socket.svelte.d.ts +9 -0
- package/dist/actions/socket.svelte.d.ts.map +1 -1
- package/dist/actions/socket.svelte.js +16 -5
- package/dist/actions/transports.d.ts +88 -34
- package/dist/actions/transports.d.ts.map +1 -1
- package/dist/actions/transports.js +76 -76
- package/dist/actions/transports_http.d.ts +48 -12
- package/dist/actions/transports_http.d.ts.map +1 -1
- package/dist/actions/transports_http.js +75 -44
- package/dist/actions/transports_ws.d.ts +29 -0
- package/dist/actions/transports_ws.d.ts.map +1 -1
- package/dist/actions/transports_ws.js +34 -8
- package/dist/actions/ws_endpoint_spec.d.ts +52 -75
- package/dist/actions/ws_endpoint_spec.d.ts.map +1 -1
- package/dist/actions/ws_endpoint_spec.js +27 -10
- package/dist/actions/ws_outbound_writer.d.ts +3 -3
- package/dist/actions/ws_outbound_writer.js +3 -3
- package/dist/actions/ws_socket_session.d.ts +321 -0
- package/dist/actions/ws_socket_session.d.ts.map +1 -0
- package/dist/actions/ws_socket_session.js +783 -0
- package/dist/auth/CLAUDE.md +70 -44
- package/dist/auth/account_action_specs.d.ts +2 -0
- package/dist/auth/account_action_specs.d.ts.map +1 -1
- package/dist/auth/account_actions.d.ts +1 -1
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +9 -3
- package/dist/auth/account_queries.d.ts +10 -0
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +27 -17
- package/dist/auth/account_routes.d.ts +2 -1
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +14 -17
- package/dist/auth/account_schema.d.ts +5 -5
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +5 -2
- package/dist/auth/actor_lookup_actions.d.ts +1 -1
- package/dist/auth/actor_lookup_actions.d.ts.map +1 -1
- package/dist/auth/actor_lookup_actions.js +1 -1
- package/dist/auth/actor_search_action_specs.d.ts.map +1 -1
- package/dist/auth/actor_search_action_specs.js +2 -1
- package/dist/auth/actor_search_actions.d.ts +1 -1
- package/dist/auth/actor_search_actions.d.ts.map +1 -1
- package/dist/auth/actor_search_actions.js +1 -1
- package/dist/auth/actor_search_queries.d.ts +5 -5
- package/dist/auth/actor_search_queries.d.ts.map +1 -1
- package/dist/auth/actor_search_queries.js +7 -7
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +3 -1
- package/dist/auth/admin_actions.d.ts +1 -1
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +12 -42
- package/dist/auth/all_cell_actions.d.ts +6 -4
- package/dist/auth/all_cell_actions.d.ts.map +1 -1
- package/dist/auth/all_cell_actions.js +1 -1
- package/dist/auth/api_token_queries.d.ts +1 -0
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +1 -0
- package/dist/auth/audit_emitter.d.ts +3 -3
- package/dist/auth/audit_emitter.js +2 -2
- package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_route_schema.js +3 -2
- package/dist/auth/audit_log_routes.d.ts +20 -11
- package/dist/auth/audit_log_routes.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.js +49 -29
- package/dist/auth/audit_log_schema.d.ts +13 -21
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +10 -18
- package/dist/auth/bearer_auth.d.ts +7 -4
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +21 -15
- package/dist/auth/cell_action_helpers.d.ts +89 -0
- package/dist/auth/cell_action_helpers.d.ts.map +1 -0
- package/dist/auth/cell_action_helpers.js +113 -0
- package/dist/auth/cell_actions.d.ts +22 -13
- package/dist/auth/cell_actions.d.ts.map +1 -1
- package/dist/auth/cell_actions.js +105 -167
- package/dist/auth/cell_audit_actions.d.ts +1 -1
- package/dist/auth/cell_audit_actions.d.ts.map +1 -1
- package/dist/auth/cell_audit_actions.js +3 -12
- package/dist/auth/cell_audit_metadata.d.ts +1 -1
- package/dist/auth/cell_audit_metadata.js +1 -1
- package/dist/auth/cell_field_actions.d.ts +1 -1
- package/dist/auth/cell_field_actions.d.ts.map +1 -1
- package/dist/auth/cell_field_actions.js +16 -66
- package/dist/auth/cell_grant_action_specs.d.ts +2 -2
- package/dist/auth/cell_grant_action_specs.js +3 -3
- package/dist/auth/cell_grant_actions.d.ts +73 -11
- package/dist/auth/cell_grant_actions.d.ts.map +1 -1
- package/dist/auth/cell_grant_actions.js +63 -55
- package/dist/auth/cell_grant_audit_metadata.d.ts +6 -3
- package/dist/auth/cell_grant_audit_metadata.d.ts.map +1 -1
- package/dist/auth/cell_grant_audit_metadata.js +7 -4
- package/dist/auth/cell_item_actions.d.ts +1 -1
- package/dist/auth/cell_item_actions.d.ts.map +1 -1
- package/dist/auth/cell_item_actions.js +21 -82
- package/dist/auth/cleanup.d.ts +1 -1
- package/dist/auth/cleanup.d.ts.map +1 -1
- package/dist/auth/cleanup.js +6 -3
- package/dist/auth/credential_deadline.d.ts +3 -3
- package/dist/auth/credential_deadline.js +3 -3
- package/dist/auth/credential_type_schema.d.ts +5 -5
- package/dist/auth/credential_type_schema.js +5 -5
- package/dist/auth/daemon_token_middleware.d.ts +12 -6
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +28 -17
- package/dist/auth/deps.d.ts +4 -4
- package/dist/auth/fail_floor.d.ts +55 -0
- package/dist/auth/fail_floor.d.ts.map +1 -0
- package/dist/auth/fail_floor.js +63 -0
- package/dist/auth/invite_queries.d.ts +3 -15
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +3 -21
- package/dist/auth/middleware.d.ts +12 -7
- package/dist/auth/middleware.d.ts.map +1 -1
- package/dist/auth/middleware.js +42 -29
- package/dist/auth/migrations.d.ts +5 -33
- package/dist/auth/migrations.d.ts.map +1 -1
- package/dist/auth/migrations.js +9 -16
- package/dist/auth/request_context.d.ts +101 -71
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +137 -140
- package/dist/auth/resolved_auth.d.ts +122 -36
- package/dist/auth/resolved_auth.d.ts.map +1 -1
- package/dist/auth/resolved_auth.js +89 -38
- package/dist/auth/role_grant_offer_action_specs.d.ts +99 -14
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +26 -13
- package/dist/auth/role_grant_offer_actions.d.ts +13 -7
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +14 -12
- package/dist/auth/role_grant_offer_notifications.d.ts +3 -3
- package/dist/auth/role_grant_offer_notifications.js +1 -1
- package/dist/auth/role_grant_offer_queries.d.ts +0 -5
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +9 -41
- package/dist/auth/role_grant_queries.d.ts +17 -67
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +34 -106
- package/dist/auth/role_grant_sql.d.ts +42 -0
- package/dist/auth/role_grant_sql.d.ts.map +1 -0
- package/dist/auth/role_grant_sql.js +54 -0
- package/dist/auth/scope_kind_schema.d.ts +1 -1
- package/dist/auth/scope_kind_schema.js +1 -1
- package/dist/auth/self_service_role_actions.d.ts +1 -1
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +1 -1
- package/dist/auth/session_queries.d.ts +2 -1
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +2 -1
- package/dist/auth/signup_routes.d.ts +2 -1
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +14 -13
- package/dist/auth/standard_rpc_actions.d.ts +1 -1
- package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
- package/dist/auth/token_scope.d.ts +19 -46
- package/dist/auth/token_scope.d.ts.map +1 -1
- package/dist/auth/token_scope.js +23 -41
- package/dist/db/CLAUDE.md +9 -4
- package/dist/db/cell_ddl.d.ts +5 -142
- package/dist/db/cell_ddl.d.ts.map +1 -1
- package/dist/db/cell_ddl.js +17 -16
- package/dist/db/cell_field_queries.d.ts +0 -13
- package/dist/db/cell_field_queries.d.ts.map +1 -1
- package/dist/db/cell_field_queries.js +0 -16
- package/dist/db/cell_grant_queries.d.ts +10 -5
- package/dist/db/cell_grant_queries.d.ts.map +1 -1
- package/dist/db/cell_grant_queries.js +13 -7
- package/dist/db/cell_item_queries.d.ts +0 -7
- package/dist/db/cell_item_queries.d.ts.map +1 -1
- package/dist/db/cell_item_queries.js +0 -10
- package/dist/db/cell_queries.d.ts +12 -48
- package/dist/db/cell_queries.d.ts.map +1 -1
- package/dist/db/cell_queries.js +24 -55
- package/dist/db/cell_view_sql.d.ts +1 -6
- package/dist/db/cell_view_sql.d.ts.map +1 -1
- package/dist/db/cell_view_sql.js +1 -2
- package/dist/db/fact_ddl.d.ts +5 -30
- package/dist/db/fact_ddl.d.ts.map +1 -1
- package/dist/db/fact_ddl.js +14 -13
- package/dist/db/fact_store.d.ts +11 -0
- package/dist/db/fact_store.d.ts.map +1 -1
- package/dist/db/fact_store.js +4 -1
- package/dist/db/migrate.d.ts +44 -6
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +63 -4
- package/dist/dev/setup.d.ts +18 -14
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +42 -39
- package/dist/env/dotenv.d.ts +2 -2
- package/dist/env/dotenv.js +2 -2
- package/dist/env/update_env_variable.d.ts +33 -21
- package/dist/env/update_env_variable.d.ts.map +1 -1
- package/dist/env/update_env_variable.js +54 -35
- package/dist/hono_context.d.ts +15 -90
- package/dist/hono_context.d.ts.map +1 -1
- package/dist/hono_context.js +9 -56
- package/dist/http/CLAUDE.md +35 -20
- package/dist/http/auth_shape.d.ts +1 -8
- package/dist/http/auth_shape.d.ts.map +1 -1
- package/dist/http/auth_shape.js +6 -12
- package/dist/http/common_routes.d.ts.map +1 -1
- package/dist/http/common_routes.js +3 -2
- package/dist/http/db_routes.d.ts +3 -3
- package/dist/http/db_routes.js +3 -3
- package/dist/http/error_schemas.d.ts +1 -2
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +1 -2
- package/dist/http/health_schema.d.ts +16 -0
- package/dist/http/health_schema.d.ts.map +1 -0
- package/dist/http/health_schema.js +12 -0
- package/dist/http/jsonrpc_errors.d.ts +22 -2
- package/dist/http/jsonrpc_errors.d.ts.map +1 -1
- package/dist/http/jsonrpc_errors.js +41 -3
- package/dist/http/jsonrpc_helpers.d.ts +60 -17
- package/dist/http/jsonrpc_helpers.d.ts.map +1 -1
- package/dist/http/jsonrpc_helpers.js +67 -25
- package/dist/http/origin.d.ts +30 -1
- package/dist/http/origin.d.ts.map +1 -1
- package/dist/http/origin.js +46 -9
- package/dist/http/origin_wildcard.d.ts +97 -0
- package/dist/http/origin_wildcard.d.ts.map +1 -0
- package/dist/http/origin_wildcard.js +142 -0
- package/dist/http/pending_effects.d.ts +28 -0
- package/dist/http/pending_effects.d.ts.map +1 -1
- package/dist/http/pending_effects.js +32 -1
- package/dist/http/route_spec.d.ts +4 -3
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +54 -45
- package/dist/http/surface.d.ts +1 -1
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface_query.d.ts +9 -50
- package/dist/http/surface_query.d.ts.map +1 -1
- package/dist/http/surface_query.js +48 -94
- package/dist/realtime/audit_log_sse.d.ts +180 -0
- package/dist/realtime/audit_log_sse.d.ts.map +1 -0
- package/dist/realtime/audit_log_sse.js +154 -0
- package/dist/realtime/sse.d.ts +21 -6
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +33 -10
- package/dist/realtime/sse_constants.d.ts +29 -2
- package/dist/realtime/sse_constants.d.ts.map +1 -1
- package/dist/realtime/sse_constants.js +35 -2
- package/dist/realtime/{subscriber_registry.d.ts → sse_registry.d.ts} +12 -12
- package/dist/realtime/sse_registry.d.ts.map +1 -0
- package/dist/realtime/{subscriber_registry.js → sse_registry.js} +4 -4
- package/dist/schema_meta.d.ts +30 -10
- package/dist/schema_meta.d.ts.map +1 -1
- package/dist/schema_meta.js +85 -21
- package/dist/sensitivity.d.ts +9 -3
- package/dist/sensitivity.d.ts.map +1 -1
- package/dist/sensitivity.js +3 -2
- package/dist/server/app_backend.d.ts +8 -5
- package/dist/server/app_backend.d.ts.map +1 -1
- package/dist/server/app_backend.js +6 -12
- package/dist/server/app_server.d.ts +62 -51
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +84 -71
- package/dist/server/app_server_context.d.ts +1 -1
- package/dist/server/app_server_context.d.ts.map +1 -1
- package/dist/server/env.d.ts +24 -20
- package/dist/server/env.d.ts.map +1 -1
- package/dist/server/env.js +24 -34
- package/dist/server/serve_fact_route.d.ts +12 -16
- package/dist/server/serve_fact_route.d.ts.map +1 -1
- package/dist/server/serve_fact_route.js +59 -34
- package/dist/server/static.d.ts.map +1 -1
- package/dist/server/static.js +2 -2
- package/dist/testing/CLAUDE.md +179 -158
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +10 -19
- package/dist/testing/adversarial_headers.d.ts.map +1 -1
- package/dist/testing/adversarial_headers.js +8 -0
- package/dist/testing/app_server.d.ts +9 -77
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +31 -112
- package/dist/testing/attack_surface.d.ts.map +1 -1
- package/dist/testing/attack_surface.js +3 -4
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +4 -5
- package/dist/testing/auth_apps.d.ts +3 -3
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +9 -6
- package/dist/testing/connection_closer_helpers.d.ts +8 -16
- package/dist/testing/connection_closer_helpers.d.ts.map +1 -1
- package/dist/testing/connection_closer_helpers.js +7 -20
- package/dist/testing/cross_backend/action_manifest.d.ts +15 -4
- package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest.js +13 -3
- package/dist/testing/cross_backend/action_manifest_parity.d.ts +15 -7
- package/dist/testing/cross_backend/action_manifest_parity.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest_parity.js +8 -1
- package/dist/testing/cross_backend/body_size.d.ts.map +1 -1
- package/dist/testing/cross_backend/body_size.js +25 -22
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts +22 -3
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -1
- package/dist/testing/cross_backend/build_test_backend_paths.js +34 -11
- package/dist/testing/cross_backend/capabilities.d.ts +13 -7
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_grant_role.js +2 -2
- package/dist/testing/cross_backend/cell_grant_steward.d.ts +4 -0
- package/dist/testing/cross_backend/cell_grant_steward.d.ts.map +1 -0
- package/dist/testing/cross_backend/cell_grant_steward.js +120 -0
- package/dist/testing/cross_backend/cell_relations.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_relations.js +21 -0
- package/dist/testing/cross_backend/conformance_table.d.ts +1 -1
- package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.d.ts +18 -4
- package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.js +29 -9
- package/dist/testing/cross_backend/default_spine_surface.d.ts +7 -7
- package/dist/testing/cross_backend/default_spine_surface.js +2 -2
- package/dist/testing/cross_backend/fact_serving.d.ts.map +1 -1
- package/dist/testing/cross_backend/fact_serving.js +48 -0
- package/dist/testing/cross_backend/full_spine_mount.d.ts +3 -4
- package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
- package/dist/testing/cross_backend/full_spine_mount.js +9 -2
- package/dist/testing/cross_backend/origin_scope.d.ts.map +1 -1
- package/dist/testing/cross_backend/origin_scope.js +5 -13
- package/dist/testing/cross_backend/peer_ping_ws.d.ts.map +1 -1
- package/dist/testing/cross_backend/peer_ping_ws.js +29 -4
- package/dist/testing/cross_backend/postgres_database.d.ts +32 -0
- package/dist/testing/cross_backend/postgres_database.d.ts.map +1 -1
- package/dist/testing/cross_backend/postgres_database.js +56 -1
- package/dist/testing/cross_backend/query_shape.d.ts.map +1 -1
- package/dist/testing/cross_backend/query_shape.js +18 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +23 -1
- package/dist/testing/cross_backend/rpc_success_fixtures.js +2 -2
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +1 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts +17 -5
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.js +5 -4
- package/dist/testing/cross_backend/session_cap.d.ts +8 -0
- package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/session_cap.js +66 -2
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +5 -4
- package/dist/testing/cross_backend/spine_suites.d.ts +4 -1
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +21 -0
- package/dist/testing/cross_backend/spine_surface_constants.d.ts +22 -7
- package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.js +22 -7
- package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/sse_round_trip.js +4 -3
- package/dist/testing/cross_backend/standard.d.ts +6 -12
- package/dist/testing/cross_backend/standard.d.ts.map +1 -1
- package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.d.ts +8 -0
- package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.d.ts.map +1 -0
- package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.js +22 -0
- package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_backdoor.js +4 -6
- package/dist/testing/cross_backend/testing_origin_check.d.ts +1 -1
- package/dist/testing/cross_backend/testing_origin_check.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_origin_check.js +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +10 -5
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +7 -6
- package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_bun.js +5 -4
- package/dist/testing/cross_backend/testing_server_core.d.ts +6 -7
- package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_core.js +1 -1
- package/dist/testing/cross_backend/testing_server_node.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_node.js +13 -2
- package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
- package/dist/testing/cross_backend/token_lifetime.js +68 -0
- package/dist/testing/cross_backend/transport_composition.d.ts +1 -1
- package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
- package/dist/testing/cross_backend/transport_composition.js +45 -3
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts +16 -2
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.js +11 -8
- package/dist/testing/cross_backend/ws_action_rate_limit.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_action_rate_limit.js +30 -12
- package/dist/testing/cross_backend/ws_connection_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_connection_cap.js +5 -7
- package/dist/testing/cross_backend/ws_endpoint.d.ts +2 -3
- package/dist/testing/cross_backend/ws_endpoint.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_envelope.d.ts +17 -0
- package/dist/testing/cross_backend/ws_envelope.d.ts.map +1 -0
- package/dist/testing/cross_backend/ws_envelope.js +172 -0
- package/dist/testing/cross_backend/ws_inbound_dispatch.d.ts +16 -0
- package/dist/testing/cross_backend/ws_inbound_dispatch.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_inbound_dispatch.js +8 -4
- package/dist/testing/cross_backend/ws_outbound_overflow.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_outbound_overflow.js +5 -8
- package/dist/testing/cross_backend/ws_role_gated.js +2 -2
- package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_round_trip.js +6 -4
- package/dist/{cli/daemon.d.ts → testing/daemon_info.d.ts} +15 -47
- package/dist/testing/daemon_info.d.ts.map +1 -0
- package/dist/testing/daemon_info.js +108 -0
- package/dist/testing/daemon_token_rotation.js +1 -1
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +3 -4
- package/dist/testing/db.js +2 -2
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +35 -65
- package/dist/testing/integration_helpers.d.ts +0 -15
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +2 -42
- package/dist/testing/middleware.d.ts +20 -12
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +49 -40
- package/dist/testing/rate_limiting.d.ts.map +1 -1
- package/dist/testing/rate_limiting.js +13 -22
- package/dist/testing/resolved_auth.d.ts +30 -0
- package/dist/testing/resolved_auth.d.ts.map +1 -0
- package/dist/testing/resolved_auth.js +41 -0
- package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
- package/dist/testing/rpc_envelope_cases.js +3 -0
- package/dist/testing/rpc_helpers.d.ts +1 -1
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +2 -1
- package/dist/testing/sse_round_trip.d.ts +5 -4
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +2 -2
- package/dist/testing/stubs.d.ts +2 -2
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +24 -21
- package/dist/testing/test_origin.d.ts +25 -0
- package/dist/testing/test_origin.d.ts.map +1 -0
- package/dist/testing/test_origin.js +28 -0
- package/dist/testing/transports/raw_http.d.ts +54 -0
- package/dist/testing/transports/raw_http.d.ts.map +1 -1
- package/dist/testing/transports/raw_http.js +58 -0
- package/dist/testing/transports/ws_raw_client.d.ts +8 -0
- package/dist/testing/transports/ws_raw_client.d.ts.map +1 -1
- package/dist/testing/transports/ws_raw_client.js +13 -0
- package/dist/testing/transports/ws_transport.d.ts +15 -2
- package/dist/testing/transports/ws_transport.d.ts.map +1 -1
- package/dist/testing/transports/ws_transport.js +4 -2
- package/dist/testing/ws_round_trip.d.ts +27 -25
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +34 -26
- package/dist/ui/AccountSessions.svelte +48 -19
- package/dist/ui/AccountSessions.svelte.d.ts +2 -17
- package/dist/ui/AccountSessions.svelte.d.ts.map +1 -1
- package/dist/ui/AdminAccounts.svelte +6 -1
- package/dist/ui/AdminAuditLog.svelte +61 -22
- package/dist/ui/AdminAuditLog.svelte.d.ts.map +1 -1
- package/dist/ui/AdminInvites.svelte +1 -1
- package/dist/ui/AdminOverview.svelte +76 -37
- package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
- package/dist/ui/AdminRoleGrantHistory.svelte +6 -1
- package/dist/ui/AdminSessions.svelte +1 -1
- package/dist/ui/AppShell.svelte +3 -2
- package/dist/ui/AppShell.svelte.d.ts +3 -2
- package/dist/ui/AppShell.svelte.d.ts.map +1 -1
- package/dist/ui/CLAUDE.md +121 -35
- package/dist/ui/Datatable.svelte +33 -18
- package/dist/ui/Datatable.svelte.d.ts +2 -14
- package/dist/ui/Datatable.svelte.d.ts.map +1 -1
- package/dist/ui/OpenSignupToggle.svelte +10 -1
- package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -1
- package/dist/ui/PopoverButton.svelte +13 -8
- package/dist/ui/PopoverButton.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferForm.svelte +3 -2
- package/dist/ui/RoleGrantOfferForm.svelte.d.ts +3 -2
- package/dist/ui/RoleGrantOfferForm.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferHistory.svelte +3 -3
- package/dist/ui/RoleGrantOfferInbox.svelte +19 -15
- package/dist/ui/RoleGrantOfferInbox.svelte.d.ts.map +1 -1
- package/dist/ui/SurfaceExplorer.svelte +66 -27
- package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
- package/dist/ui/account_sessions_state.svelte.d.ts +7 -14
- package/dist/ui/account_sessions_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.d.ts +14 -9
- package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.js +6 -4
- package/dist/ui/admin_invites_state.svelte.d.ts +2 -2
- package/dist/ui/admin_invites_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_rpc_adapters.d.ts +9 -9
- package/dist/ui/admin_rpc_adapters.d.ts.map +1 -1
- package/dist/ui/admin_rpc_adapters.js +9 -9
- package/dist/ui/app_settings_state.svelte.d.ts +2 -2
- package/dist/ui/app_settings_state.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.d.ts +70 -13
- package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.js +239 -47
- package/dist/ui/backend_probe.svelte.d.ts +93 -0
- package/dist/ui/backend_probe.svelte.d.ts.map +1 -0
- package/dist/ui/backend_probe.svelte.js +140 -0
- package/dist/ui/format_scope.d.ts +7 -7
- package/dist/ui/format_scope.d.ts.map +1 -1
- package/dist/ui/format_scope.js +4 -4
- package/dist/ui/keyed_async_slot.svelte.d.ts +2 -2
- package/dist/ui/keyed_async_slot.svelte.js +2 -2
- package/dist/ui/popover.svelte.d.ts +18 -19
- package/dist/ui/popover.svelte.d.ts.map +1 -1
- package/dist/ui/popover.svelte.js +103 -16
- package/dist/ui/role_grant_offers_state.svelte.d.ts +41 -46
- package/dist/ui/role_grant_offers_state.svelte.d.ts.map +1 -1
- package/dist/ui/role_grant_offers_state.svelte.js +37 -19
- package/dist/ui/ui_format.d.ts +17 -0
- package/dist/ui/ui_format.d.ts.map +1 -1
- package/dist/ui/ui_format.js +20 -0
- package/package.json +2 -1
- package/dist/actions/register_ws_endpoint.d.ts +0 -79
- package/dist/actions/register_ws_endpoint.d.ts.map +0 -1
- package/dist/actions/register_ws_endpoint.js +0 -109
- package/dist/actions/transports_ws_auth_guard.d.ts +0 -96
- package/dist/actions/transports_ws_auth_guard.d.ts.map +0 -1
- package/dist/actions/transports_ws_auth_guard.js +0 -141
- package/dist/actions/transports_ws_backend.d.ts.map +0 -1
- package/dist/cli/args.d.ts +0 -55
- package/dist/cli/args.d.ts.map +0 -1
- package/dist/cli/args.js +0 -100
- package/dist/cli/config.d.ts +0 -47
- package/dist/cli/config.d.ts.map +0 -1
- package/dist/cli/config.js +0 -77
- package/dist/cli/daemon.d.ts.map +0 -1
- package/dist/cli/daemon.js +0 -181
- package/dist/cli/help.d.ts +0 -124
- package/dist/cli/help.d.ts.map +0 -1
- package/dist/cli/help.js +0 -215
- package/dist/cli/logger.d.ts +0 -46
- package/dist/cli/logger.d.ts.map +0 -1
- package/dist/cli/logger.js +0 -48
- package/dist/cli/util.d.ts +0 -36
- package/dist/cli/util.d.ts.map +0 -1
- package/dist/cli/util.js +0 -50
- package/dist/realtime/sse_auth_guard.d.ts +0 -197
- package/dist/realtime/sse_auth_guard.d.ts.map +0 -1
- package/dist/realtime/sse_auth_guard.js +0 -239
- package/dist/realtime/subscriber_registry.d.ts.map +0 -1
- package/dist/testing/bootstrap_success.d.ts +0 -29
- package/dist/testing/bootstrap_success.d.ts.map +0 -1
- package/dist/testing/bootstrap_success.js +0 -144
- package/dist/testing/mock_fs.d.ts +0 -20
- package/dist/testing/mock_fs.d.ts.map +0 -1
- package/dist/testing/mock_fs.js +0 -28
- package/dist/testing/standard.d.ts +0 -122
- package/dist/testing/standard.d.ts.map +0 -1
- package/dist/testing/standard.js +0 -73
- package/dist/testing/testing_rate_limiter.d.ts +0 -65
- package/dist/testing/testing_rate_limiter.d.ts.map +0 -1
- package/dist/testing/testing_rate_limiter.js +0 -80
package/dist/cli/config.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generic CLI configuration loader.
|
|
3
|
-
*
|
|
4
|
-
* Manages CLI-specific configuration stored at `~/.{name}/config.json`.
|
|
5
|
-
* Consumers keep their project-specific `@fuzdev/fuz_schema` schemas locally
|
|
6
|
-
* and use these generic load/save functions.
|
|
7
|
-
*
|
|
8
|
-
* @module
|
|
9
|
-
*/
|
|
10
|
-
import { type Schema } from '@fuzdev/fuz_schema/schema.ts';
|
|
11
|
-
import type { EnvDeps, FsReadDeps, FsWriteDeps, LogDeps } from '../runtime/deps.js';
|
|
12
|
-
/**
|
|
13
|
-
* Get the CLI config directory path (`~/.{name}`).
|
|
14
|
-
*
|
|
15
|
-
* @param runtime - runtime with `env_get` capability
|
|
16
|
-
* @param name - application name (e.g., `"tx"`, `"zzz"`)
|
|
17
|
-
* @returns path to config directory, or null if `$HOME` is not set
|
|
18
|
-
*/
|
|
19
|
-
export declare const get_app_dir: (runtime: Pick<EnvDeps, "env_get">, name: string) => string | null;
|
|
20
|
-
/**
|
|
21
|
-
* Get the CLI config file path (`~/.{name}/config.json`).
|
|
22
|
-
*
|
|
23
|
-
* @param runtime - runtime with `env_get` capability
|
|
24
|
-
* @param name - application name
|
|
25
|
-
* @returns path to `config.json`, or null if `$HOME` is not set
|
|
26
|
-
*/
|
|
27
|
-
export declare const get_config_path: (runtime: Pick<EnvDeps, "env_get">, name: string) => string | null;
|
|
28
|
-
/**
|
|
29
|
-
* Load CLI configuration from a JSON file validated by a `@fuzdev/fuz_schema` schema.
|
|
30
|
-
*
|
|
31
|
-
* @param runtime - runtime with file read capability
|
|
32
|
-
* @param path - path to the config JSON file
|
|
33
|
-
* @param schema - fuz_schema schema to validate against
|
|
34
|
-
* @returns parsed config, or null if file doesn't exist or is invalid
|
|
35
|
-
*/
|
|
36
|
-
export declare const load_config: <T>(runtime: Pick<FsReadDeps, "stat" | "read_text_file"> & LogDeps, path: string, schema: Schema<T, any>) => Promise<T | null>;
|
|
37
|
-
/**
|
|
38
|
-
* Save CLI configuration to a JSON file.
|
|
39
|
-
*
|
|
40
|
-
* @param runtime - runtime with file write capability
|
|
41
|
-
* @param path - path to the config JSON file
|
|
42
|
-
* @param dir - directory containing the config file (created if missing)
|
|
43
|
-
* @param config - configuration to save
|
|
44
|
-
* @mutates filesystem - creates `dir` (recursive) and writes JSON to `path`
|
|
45
|
-
*/
|
|
46
|
-
export declare const save_config: <T>(runtime: Pick<FsWriteDeps, "mkdir" | "write_text_file">, path: string, dir: string, config: T) => Promise<void>;
|
|
47
|
-
//# sourceMappingURL=config.d.ts.map
|
package/dist/cli/config.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/cli/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAuB,KAAK,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAEhF,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAEpF;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,MAAM,KAAG,MAAM,GAAG,IAGtF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAI,SAAS,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,MAAM,KAAG,MAAM,GAAG,IAG1F,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,GAAU,CAAC,EAClC,SAAS,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB,CAAC,GAAG,OAAO,EAC9D,MAAM,MAAM,EACZ,QAAQ,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,KACpB,OAAO,CAAC,CAAC,GAAG,IAAI,CAoBlB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,GAAU,CAAC,EAClC,SAAS,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,iBAAiB,CAAC,EACvD,MAAM,MAAM,EACZ,KAAK,MAAM,EACX,QAAQ,CAAC,KACP,OAAO,CAAC,IAAI,CAOd,CAAC"}
|
package/dist/cli/config.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generic CLI configuration loader.
|
|
3
|
-
*
|
|
4
|
-
* Manages CLI-specific configuration stored at `~/.{name}/config.json`.
|
|
5
|
-
* Consumers keep their project-specific `@fuzdev/fuz_schema` schemas locally
|
|
6
|
-
* and use these generic load/save functions.
|
|
7
|
-
*
|
|
8
|
-
* @module
|
|
9
|
-
*/
|
|
10
|
-
import { format_issue, parse } from '@fuzdev/fuz_schema/schema.ts';
|
|
11
|
-
/**
|
|
12
|
-
* Get the CLI config directory path (`~/.{name}`).
|
|
13
|
-
*
|
|
14
|
-
* @param runtime - runtime with `env_get` capability
|
|
15
|
-
* @param name - application name (e.g., `"tx"`, `"zzz"`)
|
|
16
|
-
* @returns path to config directory, or null if `$HOME` is not set
|
|
17
|
-
*/
|
|
18
|
-
export const get_app_dir = (runtime, name) => {
|
|
19
|
-
const home = runtime.env_get('HOME');
|
|
20
|
-
return home ? `${home}/.${name}` : null;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Get the CLI config file path (`~/.{name}/config.json`).
|
|
24
|
-
*
|
|
25
|
-
* @param runtime - runtime with `env_get` capability
|
|
26
|
-
* @param name - application name
|
|
27
|
-
* @returns path to `config.json`, or null if `$HOME` is not set
|
|
28
|
-
*/
|
|
29
|
-
export const get_config_path = (runtime, name) => {
|
|
30
|
-
const app_dir = get_app_dir(runtime, name);
|
|
31
|
-
return app_dir ? `${app_dir}/config.json` : null;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Load CLI configuration from a JSON file validated by a `@fuzdev/fuz_schema` schema.
|
|
35
|
-
*
|
|
36
|
-
* @param runtime - runtime with file read capability
|
|
37
|
-
* @param path - path to the config JSON file
|
|
38
|
-
* @param schema - fuz_schema schema to validate against
|
|
39
|
-
* @returns parsed config, or null if file doesn't exist or is invalid
|
|
40
|
-
*/
|
|
41
|
-
export const load_config = async (runtime, path, schema) => {
|
|
42
|
-
// check if file exists
|
|
43
|
-
const stat = await runtime.stat(path);
|
|
44
|
-
if (!stat) {
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
try {
|
|
48
|
-
const content = await runtime.read_text_file(path);
|
|
49
|
-
const parsed = JSON.parse(content);
|
|
50
|
-
const result = parse(schema, parsed);
|
|
51
|
-
if (!result.ok) {
|
|
52
|
-
runtime.warn(`Invalid config.json: ${result.issues.map(format_issue).join('; ')}`);
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
return result.value;
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
58
|
-
runtime.warn(`Failed to read config.json: ${error.message}`);
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* Save CLI configuration to a JSON file.
|
|
64
|
-
*
|
|
65
|
-
* @param runtime - runtime with file write capability
|
|
66
|
-
* @param path - path to the config JSON file
|
|
67
|
-
* @param dir - directory containing the config file (created if missing)
|
|
68
|
-
* @param config - configuration to save
|
|
69
|
-
* @mutates filesystem - creates `dir` (recursive) and writes JSON to `path`
|
|
70
|
-
*/
|
|
71
|
-
export const save_config = async (runtime, path, dir, config) => {
|
|
72
|
-
// ensure directory exists
|
|
73
|
-
await runtime.mkdir(dir, { recursive: true });
|
|
74
|
-
// write with pretty formatting
|
|
75
|
-
const content = JSON.stringify(config, null, '\t');
|
|
76
|
-
await runtime.write_text_file(path, content + '\n');
|
|
77
|
-
};
|
package/dist/cli/daemon.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"daemon.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/cli/daemon.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAMN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACN,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,MAAM,oBAAoB,CAAC;AAI5B;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;IACtB,sBAAsB;;IAEtB,yBAAyB;;IAEzB,uCAAuC;;IAEvC,yCAAyC;;IAEzC,0CAA0C;;EAEzC,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAElD;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAChC,SAAS,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,EACjC,MAAM,MAAM,KACV,MAAM,GAAG,IAGX,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,GAC7B,SAAS,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,iBAAiB,GAAG,QAAQ,CAAC,EAC7F,MAAM,MAAM,EACZ,MAAM,UAAU,KACd,OAAO,CAAC,IAAI,CAWd,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAC5B,SAAS,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB,CAAC,GAAG,OAAO,EACzF,MAAM,MAAM,KACV,OAAO,CAAC,UAAU,GAAG,IAAI,CAwB3B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAAU,SAAS,WAAW,EAAE,KAAK,MAAM,KAAG,OAAO,CAAC,OAAO,CAG1F,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,GAC/B,MAAM,SAAS,EACf,MAAM,MAAM,EACZ,aAAkB,EAClB,mBAAiB,KACf,OAAO,CAAC,OAAO,CAYjB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,oCAAoC;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,yCAAyC;IACzC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,GACvB,SAAS,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,GAChC,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB,CAAC,GAC3C,YAAY,GACZ,WAAW,GACX,OAAO,EACR,MAAM,MAAM,KACV,OAAO,CAAC,gBAAgB,CA2C1B,CAAC"}
|
package/dist/cli/daemon.js
DELETED
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Daemon lifecycle management.
|
|
3
|
-
*
|
|
4
|
-
* Provides daemon info schema, PID file management, and process lifecycle
|
|
5
|
-
* operations. Separates lifecycle from presentation — `stop_daemon` returns
|
|
6
|
-
* a result object instead of logging directly.
|
|
7
|
-
*
|
|
8
|
-
* @module
|
|
9
|
-
*/
|
|
10
|
-
import { format_issue, number, object, parse, string } from '@fuzdev/fuz_schema/schema.ts';
|
|
11
|
-
import {} from '../runtime/deps.js';
|
|
12
|
-
import { write_file_atomic } from '../runtime/fs.js';
|
|
13
|
-
import { get_app_dir } from './config.js';
|
|
14
|
-
/**
|
|
15
|
-
* Daemon info schema for `~/.{name}/run/daemon.json`, a strict
|
|
16
|
-
* `@fuzdev/fuz_schema` object schema.
|
|
17
|
-
*/
|
|
18
|
-
export const DaemonInfo = object({
|
|
19
|
-
/** Schema version. */
|
|
20
|
-
version: number,
|
|
21
|
-
/** Server process ID. */
|
|
22
|
-
pid: number,
|
|
23
|
-
/** Port the server is listening on. */
|
|
24
|
-
port: number,
|
|
25
|
-
/** ISO timestamp when server started. */
|
|
26
|
-
started: string,
|
|
27
|
-
/** Package version of the application. */
|
|
28
|
-
app_version: string
|
|
29
|
-
});
|
|
30
|
-
/**
|
|
31
|
-
* Get the daemon info file path (`~/.{name}/run/daemon.json`).
|
|
32
|
-
*
|
|
33
|
-
* @param runtime - runtime with `env_get` capability
|
|
34
|
-
* @param name - application name
|
|
35
|
-
* @returns path to `daemon.json`, or null if `$HOME` is not set
|
|
36
|
-
*/
|
|
37
|
-
export const get_daemon_info_path = (runtime, name) => {
|
|
38
|
-
const app_dir = get_app_dir(runtime, name);
|
|
39
|
-
return app_dir ? `${app_dir}/run/daemon.json` : null;
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Write daemon info to the PID file, creating directories as needed.
|
|
43
|
-
*
|
|
44
|
-
* @param runtime - runtime with file write and env capabilities
|
|
45
|
-
* @param name - application name
|
|
46
|
-
* @param info - daemon info to write
|
|
47
|
-
* @mutates filesystem - creates `~/.{name}/run/` and atomically writes `daemon.json`
|
|
48
|
-
* @throws Error if `$HOME` is not set
|
|
49
|
-
*/
|
|
50
|
-
export const write_daemon_info = async (runtime, name, info) => {
|
|
51
|
-
const app_dir = get_app_dir(runtime, name);
|
|
52
|
-
if (!app_dir) {
|
|
53
|
-
throw new Error('$HOME not set');
|
|
54
|
-
}
|
|
55
|
-
const run_dir = `${app_dir}/run`;
|
|
56
|
-
await runtime.mkdir(run_dir, { recursive: true });
|
|
57
|
-
const content = JSON.stringify(info, null, '\t');
|
|
58
|
-
await write_file_atomic(runtime, `${run_dir}/daemon.json`, content + '\n');
|
|
59
|
-
};
|
|
60
|
-
/**
|
|
61
|
-
* Read and validate daemon info from the PID file.
|
|
62
|
-
*
|
|
63
|
-
* @param runtime - runtime with file read and env capabilities
|
|
64
|
-
* @param name - application name
|
|
65
|
-
* @returns parsed daemon info, or null if missing or invalid
|
|
66
|
-
*/
|
|
67
|
-
export const read_daemon_info = async (runtime, name) => {
|
|
68
|
-
const daemon_path = get_daemon_info_path(runtime, name);
|
|
69
|
-
if (!daemon_path) {
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
const stat = await runtime.stat(daemon_path);
|
|
73
|
-
if (!stat) {
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
try {
|
|
77
|
-
const content = await runtime.read_text_file(daemon_path);
|
|
78
|
-
const parsed = JSON.parse(content);
|
|
79
|
-
const result = parse(DaemonInfo, parsed);
|
|
80
|
-
if (!result.ok) {
|
|
81
|
-
runtime.warn(`Invalid daemon.json: ${result.issues.map(format_issue).join('; ')}`);
|
|
82
|
-
return null;
|
|
83
|
-
}
|
|
84
|
-
return result.value;
|
|
85
|
-
}
|
|
86
|
-
catch {
|
|
87
|
-
runtime.warn('Failed to parse daemon.json');
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
/**
|
|
92
|
-
* Check if a process is running by PID.
|
|
93
|
-
*
|
|
94
|
-
* @param runtime - runtime with command execution capability
|
|
95
|
-
* @param pid - process ID to check
|
|
96
|
-
* @returns `true` if the process is running
|
|
97
|
-
*/
|
|
98
|
-
export const is_daemon_running = async (runtime, pid) => {
|
|
99
|
-
const result = await runtime.run_command('kill', ['-0', String(pid)]);
|
|
100
|
-
return result.success;
|
|
101
|
-
};
|
|
102
|
-
/**
|
|
103
|
-
* Check if a daemon is healthy by probing its `/health` endpoint.
|
|
104
|
-
*
|
|
105
|
-
* Complements `is_daemon_running` (PID check) with an HTTP liveness probe.
|
|
106
|
-
* Requires the daemon to register a `/health` route (e.g. via `create_health_route_spec`).
|
|
107
|
-
*
|
|
108
|
-
* @param deps - runtime with fetch capability
|
|
109
|
-
* @param port - port the daemon should be listening on
|
|
110
|
-
* @param host - hostname (default `localhost`)
|
|
111
|
-
* @param timeout_ms - request timeout in milliseconds (default 2000)
|
|
112
|
-
* @returns `true` if the health endpoint responds with 2xx
|
|
113
|
-
*/
|
|
114
|
-
export const check_daemon_health = async (deps, port, host = 'localhost', timeout_ms = 2000) => {
|
|
115
|
-
try {
|
|
116
|
-
const controller = new AbortController();
|
|
117
|
-
const timer = setTimeout(() => controller.abort(), timeout_ms);
|
|
118
|
-
const response = await deps.fetch(`http://${host}:${port}/health`, {
|
|
119
|
-
signal: controller.signal
|
|
120
|
-
});
|
|
121
|
-
clearTimeout(timer);
|
|
122
|
-
return response.ok;
|
|
123
|
-
}
|
|
124
|
-
catch {
|
|
125
|
-
return false;
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
/**
|
|
129
|
-
* Stop a running daemon by sending SIGTERM and cleaning up the PID file.
|
|
130
|
-
*
|
|
131
|
-
* Returns a result object instead of logging directly, separating
|
|
132
|
-
* lifecycle from presentation. Errors removing the PID file are swallowed
|
|
133
|
-
* (the daemon's own shutdown handler may have removed it concurrently).
|
|
134
|
-
*
|
|
135
|
-
* @param runtime - runtime with command, file, and env capabilities
|
|
136
|
-
* @param name - application name
|
|
137
|
-
* @returns result describing the outcome
|
|
138
|
-
* @mutates filesystem - removes `~/.{name}/run/daemon.json` on success or when corrupt
|
|
139
|
-
* @mutates external process - sends `SIGTERM` to the daemon process via `kill`
|
|
140
|
-
*/
|
|
141
|
-
export const stop_daemon = async (runtime, name) => {
|
|
142
|
-
const daemon_path = get_daemon_info_path(runtime, name);
|
|
143
|
-
if (!daemon_path) {
|
|
144
|
-
return { stopped: false, message: '$HOME not set' };
|
|
145
|
-
}
|
|
146
|
-
// check if daemon.json exists
|
|
147
|
-
const stat = await runtime.stat(daemon_path);
|
|
148
|
-
if (!stat) {
|
|
149
|
-
return { stopped: false, message: 'No daemon running (no daemon.json found)' };
|
|
150
|
-
}
|
|
151
|
-
// read and validate daemon info
|
|
152
|
-
const info = await read_daemon_info(runtime, name);
|
|
153
|
-
if (!info) {
|
|
154
|
-
// corrupt file, clean up
|
|
155
|
-
try {
|
|
156
|
-
await runtime.remove(daemon_path);
|
|
157
|
-
}
|
|
158
|
-
catch {
|
|
159
|
-
// already removed
|
|
160
|
-
}
|
|
161
|
-
return { stopped: false, message: 'Corrupt daemon.json, removed' };
|
|
162
|
-
}
|
|
163
|
-
// send SIGTERM
|
|
164
|
-
const result = await runtime.run_command('kill', [String(info.pid)]);
|
|
165
|
-
const stopped = result.success;
|
|
166
|
-
// clean up daemon.json
|
|
167
|
-
try {
|
|
168
|
-
await runtime.remove(daemon_path);
|
|
169
|
-
}
|
|
170
|
-
catch {
|
|
171
|
-
// already removed by daemon's own shutdown handler
|
|
172
|
-
}
|
|
173
|
-
if (stopped) {
|
|
174
|
-
return { stopped: true, pid: info.pid, message: `Stopped daemon (pid ${info.pid})` };
|
|
175
|
-
}
|
|
176
|
-
return {
|
|
177
|
-
stopped: false,
|
|
178
|
-
pid: info.pid,
|
|
179
|
-
message: `Process ${info.pid} not running, cleaned up stale daemon.json`
|
|
180
|
-
};
|
|
181
|
-
};
|
package/dist/cli/help.d.ts
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schema-driven CLI help generator.
|
|
3
|
-
*
|
|
4
|
-
* Generalized from the identical pattern in tx and zzz. Consumers configure
|
|
5
|
-
* once with `create_help` and get back `generate_main_help`,
|
|
6
|
-
* `generate_command_help`, and `get_help_text`.
|
|
7
|
-
*
|
|
8
|
-
* Schemas are `@fuzdev/fuz_schema` object schemas, the ones `parse_command_args`
|
|
9
|
-
* and `create_extract_global_flags` take, read with fuz_schema's `introspect.ts`:
|
|
10
|
-
* each entry's `description` and `aliases` metadata, its default, and its type
|
|
11
|
-
* as `format_schema_type` renders it.
|
|
12
|
-
*
|
|
13
|
-
* @module
|
|
14
|
-
*/
|
|
15
|
-
import type { AnySchema } from '@fuzdev/fuz_schema/schema.ts';
|
|
16
|
-
/**
|
|
17
|
-
* Command metadata for help generation.
|
|
18
|
-
*/
|
|
19
|
-
export interface CommandMeta<TCategory extends string = string> {
|
|
20
|
-
/** fuz_schema object schema for the command's args. */
|
|
21
|
-
schema?: AnySchema;
|
|
22
|
-
summary: string;
|
|
23
|
-
usage: string;
|
|
24
|
-
category: TCategory;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Category configuration for help display.
|
|
28
|
-
*/
|
|
29
|
-
export interface HelpCategory<TCategory extends string = string> {
|
|
30
|
-
key: TCategory;
|
|
31
|
-
title: string;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Configuration for `create_help`.
|
|
35
|
-
*/
|
|
36
|
-
export interface HelpOptions<TCategory extends string = string> {
|
|
37
|
-
/** Application name (e.g., `"tx"`, `"zzz"`). */
|
|
38
|
-
name: string;
|
|
39
|
-
/** Application version string. */
|
|
40
|
-
version: string;
|
|
41
|
-
/** Short description for the main help header. */
|
|
42
|
-
description: string;
|
|
43
|
-
/** Command registry keyed by command path (e.g., `"apply"`, `"daemon start"`). */
|
|
44
|
-
commands: Record<string, CommandMeta<TCategory>>;
|
|
45
|
-
/** Category display order for main help. */
|
|
46
|
-
categories: Array<HelpCategory<TCategory>>;
|
|
47
|
-
/** Example commands for main help. */
|
|
48
|
-
examples: Array<string>;
|
|
49
|
-
/** fuz_schema object schema for global arguments (shown in all help output). */
|
|
50
|
-
global_args_schema: AnySchema;
|
|
51
|
-
/** Whether to use ANSI colors in output. Defaults to `true`. */
|
|
52
|
-
use_colors?: boolean;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Help generator returned by `create_help`.
|
|
56
|
-
*/
|
|
57
|
-
export interface HelpGenerator {
|
|
58
|
-
/** Generate main help text with all commands grouped by category. */
|
|
59
|
-
generate_main_help: () => string;
|
|
60
|
-
/** Generate help text for a specific command. */
|
|
61
|
-
generate_command_help: (command: string, meta: CommandMeta) => string;
|
|
62
|
-
/** Get help text for a command or main help. */
|
|
63
|
-
get_help_text: (command?: string, subcommand?: string) => string;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* One arg as help output shows it, read from an entry of an object schema.
|
|
67
|
-
*/
|
|
68
|
-
export interface HelpArgProperty {
|
|
69
|
-
/** The entry's key, `_` for positionals. */
|
|
70
|
-
name: string;
|
|
71
|
-
/** The type the entry accepts, as `format_schema_type` renders it. */
|
|
72
|
-
type: string;
|
|
73
|
-
/** The `description` metadata, or `''`. */
|
|
74
|
-
description: string;
|
|
75
|
-
/** The default, made by calling a `with_default_fn`'s function, or `undefined`. */
|
|
76
|
-
default: unknown;
|
|
77
|
-
/** The `aliases` metadata, or `[]`. */
|
|
78
|
-
aliases: Array<string>;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Read the args of an object schema for help output, in order.
|
|
82
|
-
*
|
|
83
|
-
* An entry whose `no-` negation is also an entry is left out, so a pair like
|
|
84
|
-
* `color` and `no-color` is shown once, as `--no-color`.
|
|
85
|
-
*
|
|
86
|
-
* @param schema - fuz_schema object schema
|
|
87
|
-
* @returns the args, none when `schema` is not an object schema
|
|
88
|
-
*/
|
|
89
|
-
export declare const to_help_arg_properties: (schema: AnySchema) => Array<HelpArgProperty>;
|
|
90
|
-
/**
|
|
91
|
-
* Format a default value for display, `''` for none.
|
|
92
|
-
*
|
|
93
|
-
* Strings and arrays are written as JSON, as the type column writes a string literal.
|
|
94
|
-
*
|
|
95
|
-
* @param value - the default
|
|
96
|
-
* @returns display text
|
|
97
|
-
*/
|
|
98
|
-
export declare const format_arg_default: (value: unknown) => string;
|
|
99
|
-
/**
|
|
100
|
-
* Get maximum length from array.
|
|
101
|
-
*
|
|
102
|
-
* @param items - array of items
|
|
103
|
-
* @param to_string - function to convert item to string for length measurement
|
|
104
|
-
* @returns maximum string length
|
|
105
|
-
*/
|
|
106
|
-
export declare const to_max_length: <T>(items: Array<T>, to_string: (item: T) => string) => number;
|
|
107
|
-
/**
|
|
108
|
-
* Format argument name with short aliases for display.
|
|
109
|
-
*
|
|
110
|
-
* Only single-char aliases are shown (e.g., `-h, --help`).
|
|
111
|
-
* Flags use snake_case (e.g., `--env_file`, `--detect_only`).
|
|
112
|
-
*
|
|
113
|
-
* @param prop - schema property
|
|
114
|
-
* @returns formatted name string
|
|
115
|
-
*/
|
|
116
|
-
export declare const format_arg_name: (prop: HelpArgProperty) => string;
|
|
117
|
-
/**
|
|
118
|
-
* Create a help generator configured for an application.
|
|
119
|
-
*
|
|
120
|
-
* @param options - help configuration
|
|
121
|
-
* @returns help generator with `generate_main_help`, `generate_command_help`, and `get_help_text`
|
|
122
|
-
*/
|
|
123
|
-
export declare const create_help: <TCategory extends string>(options: HelpOptions<TCategory>) => HelpGenerator;
|
|
124
|
-
//# sourceMappingURL=help.d.ts.map
|
package/dist/cli/help.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/cli/help.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,8BAA8B,CAAC;AAY1E;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM;IAC7D,uDAAuD;IACvD,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,SAAS,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM;IAC9D,GAAG,EAAE,SAAS,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM;IAC7D,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,kFAAkF;IAClF,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;IACjD,4CAA4C;IAC5C,UAAU,EAAE,KAAK,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC;IAC3C,sCAAsC;IACtC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACxB,gFAAgF;IAChF,kBAAkB,EAAE,SAAS,CAAC;IAC9B,gEAAgE;IAChE,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,qEAAqE;IACrE,kBAAkB,EAAE,MAAM,MAAM,CAAC;IACjC,iDAAiD;IACjD,qBAAqB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,KAAK,MAAM,CAAC;IACtE,gDAAgD;IAChD,aAAa,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;CACjE;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,mFAAmF;IACnF,OAAO,EAAE,OAAO,CAAC;IACjB,uCAAuC;IACvC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACvB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,GAAI,QAAQ,SAAS,KAAG,KAAK,CAAC,eAAe,CAe/E,CAAC;AA6BF;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,GAAI,OAAO,OAAO,KAAG,MAMnD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,KAAG,MACb,CAAC;AAEvE;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,GAAI,MAAM,eAAe,KAAG,MAWvD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,SAAS,MAAM,EACnD,SAAS,WAAW,CAAC,SAAS,CAAC,KAC7B,aAoHF,CAAC"}
|
package/dist/cli/help.js
DELETED
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schema-driven CLI help generator.
|
|
3
|
-
*
|
|
4
|
-
* Generalized from the identical pattern in tx and zzz. Consumers configure
|
|
5
|
-
* once with `create_help` and get back `generate_main_help`,
|
|
6
|
-
* `generate_command_help`, and `get_help_text`.
|
|
7
|
-
*
|
|
8
|
-
* Schemas are `@fuzdev/fuz_schema` object schemas, the ones `parse_command_args`
|
|
9
|
-
* and `create_extract_global_flags` take, read with fuz_schema's `introspect.ts`:
|
|
10
|
-
* each entry's `description` and `aliases` metadata, its default, and its type
|
|
11
|
-
* as `format_schema_type` renders it.
|
|
12
|
-
*
|
|
13
|
-
* @module
|
|
14
|
-
*/
|
|
15
|
-
import { format_schema_type, get_schema_fields, get_schema_meta } from '@fuzdev/fuz_schema/introspect.ts';
|
|
16
|
-
import { colors } from './util.js';
|
|
17
|
-
/**
|
|
18
|
-
* Read the args of an object schema for help output, in order.
|
|
19
|
-
*
|
|
20
|
-
* An entry whose `no-` negation is also an entry is left out, so a pair like
|
|
21
|
-
* `color` and `no-color` is shown once, as `--no-color`.
|
|
22
|
-
*
|
|
23
|
-
* @param schema - fuz_schema object schema
|
|
24
|
-
* @returns the args, none when `schema` is not an object schema
|
|
25
|
-
*/
|
|
26
|
-
export const to_help_arg_properties = (schema) => {
|
|
27
|
-
const fields = get_schema_fields(schema);
|
|
28
|
-
const names = new Set(fields.map((f) => f.name));
|
|
29
|
-
const properties = [];
|
|
30
|
-
for (const field of fields) {
|
|
31
|
-
if (names.has('no-' + field.name))
|
|
32
|
-
continue;
|
|
33
|
-
properties.push({
|
|
34
|
-
name: field.name,
|
|
35
|
-
type: format_schema_type(field.schema),
|
|
36
|
-
description: field.description ?? '',
|
|
37
|
-
default: to_field_default(field),
|
|
38
|
-
aliases: get_schema_meta(field.schema, 'aliases') ?? []
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
return properties;
|
|
42
|
-
};
|
|
43
|
-
// the default a field's help shows: a `with_default_fn`'s is made by calling its `make`,
|
|
44
|
-
// as each parse that fills the key in does, found by walking the layers `get_schema_fields`
|
|
45
|
-
// reads, whose first `optional` or default it is when `default_computed`
|
|
46
|
-
const to_field_default = (field) => {
|
|
47
|
-
if (!field.default_computed)
|
|
48
|
-
return field.default;
|
|
49
|
-
let layer = field.schema;
|
|
50
|
-
for (;;) {
|
|
51
|
-
switch (layer.kind) {
|
|
52
|
-
case 'with_default_fn':
|
|
53
|
-
return layer.def.make();
|
|
54
|
-
case 'optional':
|
|
55
|
-
case 'nullable':
|
|
56
|
-
case 'with_default':
|
|
57
|
-
layer = layer.def.schema;
|
|
58
|
-
break;
|
|
59
|
-
case 'pipe':
|
|
60
|
-
layer = layer.def[0];
|
|
61
|
-
break;
|
|
62
|
-
case 'lazy':
|
|
63
|
-
layer = layer.def();
|
|
64
|
-
break;
|
|
65
|
-
default:
|
|
66
|
-
return undefined;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* Format a default value for display, `''` for none.
|
|
72
|
-
*
|
|
73
|
-
* Strings and arrays are written as JSON, as the type column writes a string literal.
|
|
74
|
-
*
|
|
75
|
-
* @param value - the default
|
|
76
|
-
* @returns display text
|
|
77
|
-
*/
|
|
78
|
-
export const format_arg_default = (value) => {
|
|
79
|
-
if (value === undefined)
|
|
80
|
-
return '';
|
|
81
|
-
if (value === null)
|
|
82
|
-
return 'null';
|
|
83
|
-
if (typeof value === 'string' || typeof value === 'object')
|
|
84
|
-
return JSON.stringify(value);
|
|
85
|
-
if (typeof value === 'boolean' || typeof value === 'number')
|
|
86
|
-
return String(value);
|
|
87
|
-
return '';
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* Get maximum length from array.
|
|
91
|
-
*
|
|
92
|
-
* @param items - array of items
|
|
93
|
-
* @param to_string - function to convert item to string for length measurement
|
|
94
|
-
* @returns maximum string length
|
|
95
|
-
*/
|
|
96
|
-
export const to_max_length = (items, to_string) => items.reduce((max, item) => Math.max(to_string(item).length, max), 0);
|
|
97
|
-
/**
|
|
98
|
-
* Format argument name with short aliases for display.
|
|
99
|
-
*
|
|
100
|
-
* Only single-char aliases are shown (e.g., `-h, --help`).
|
|
101
|
-
* Flags use snake_case (e.g., `--env_file`, `--detect_only`).
|
|
102
|
-
*
|
|
103
|
-
* @param prop - schema property
|
|
104
|
-
* @returns formatted name string
|
|
105
|
-
*/
|
|
106
|
-
export const format_arg_name = (prop) => {
|
|
107
|
-
if (prop.name === '_') {
|
|
108
|
-
return '[...args]';
|
|
109
|
-
}
|
|
110
|
-
let name = `--${prop.name}`;
|
|
111
|
-
const short_aliases = prop.aliases.filter((a) => a.length === 1);
|
|
112
|
-
if (short_aliases.length > 0) {
|
|
113
|
-
const alias_str = short_aliases.map((a) => `-${a}`).join(', ');
|
|
114
|
-
name = `${alias_str}, ${name}`;
|
|
115
|
-
}
|
|
116
|
-
return name;
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
* Create a help generator configured for an application.
|
|
120
|
-
*
|
|
121
|
-
* @param options - help configuration
|
|
122
|
-
* @returns help generator with `generate_main_help`, `generate_command_help`, and `get_help_text`
|
|
123
|
-
*/
|
|
124
|
-
export const create_help = (options) => {
|
|
125
|
-
const use_colors = options.use_colors !== false;
|
|
126
|
-
const c = use_colors
|
|
127
|
-
? colors
|
|
128
|
-
: { green: '', yellow: '', blue: '', red: '', cyan: '', dim: '', bold: '', reset: '' };
|
|
129
|
-
const generate_global_options = () => {
|
|
130
|
-
const properties = to_help_arg_properties(options.global_args_schema);
|
|
131
|
-
const max_width = to_max_length(properties, (p) => ` ${format_arg_name(p)}`);
|
|
132
|
-
return properties.map((prop) => {
|
|
133
|
-
const name = format_arg_name(prop);
|
|
134
|
-
const desc = prop.description || '';
|
|
135
|
-
return ` ${name}`.padEnd(max_width + 2) + desc;
|
|
136
|
-
});
|
|
137
|
-
};
|
|
138
|
-
const generate_command_help = (command, meta) => {
|
|
139
|
-
const lines = [];
|
|
140
|
-
lines.push(`${c.cyan}${options.name} ${command}${c.reset}: ${meta.summary}`);
|
|
141
|
-
lines.push('');
|
|
142
|
-
lines.push(`${c.yellow}Usage${c.reset}: ${meta.usage}`);
|
|
143
|
-
lines.push('');
|
|
144
|
-
if (meta.schema) {
|
|
145
|
-
const properties = to_help_arg_properties(meta.schema);
|
|
146
|
-
const flag_props = properties.filter((p) => p.name !== '_');
|
|
147
|
-
const positional_prop = properties.find((p) => p.name === '_');
|
|
148
|
-
if (positional_prop?.description) {
|
|
149
|
-
lines.push(`Positional: ${positional_prop.description}`);
|
|
150
|
-
lines.push('');
|
|
151
|
-
}
|
|
152
|
-
if (flag_props.length > 0) {
|
|
153
|
-
lines.push(`${c.yellow}Options${c.reset}:`);
|
|
154
|
-
const longest_name = to_max_length(flag_props, format_arg_name);
|
|
155
|
-
const longest_type = to_max_length(flag_props, (p) => p.type);
|
|
156
|
-
for (const prop of flag_props) {
|
|
157
|
-
const name = format_arg_name(prop).padEnd(longest_name);
|
|
158
|
-
const type = prop.type.padEnd(longest_type);
|
|
159
|
-
const def = format_arg_default(prop.default);
|
|
160
|
-
const desc = prop.description || '';
|
|
161
|
-
const default_str = def ? ` (default: ${def})` : '';
|
|
162
|
-
lines.push(` ${name} ${type} ${desc}${default_str}`);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
// global options
|
|
167
|
-
lines.push('');
|
|
168
|
-
lines.push(`${c.yellow}Global Options${c.reset}:`);
|
|
169
|
-
for (const opt_line of generate_global_options()) {
|
|
170
|
-
lines.push(opt_line);
|
|
171
|
-
}
|
|
172
|
-
return lines.join('\n');
|
|
173
|
-
};
|
|
174
|
-
const generate_main_help = () => {
|
|
175
|
-
const lines = [];
|
|
176
|
-
lines.push(`${c.cyan}${options.name}${c.reset} v${options.version} - ${options.description}`);
|
|
177
|
-
lines.push('');
|
|
178
|
-
// categories with commands
|
|
179
|
-
for (const { key, title } of options.categories) {
|
|
180
|
-
const cat_commands = Object.entries(options.commands).filter(([_, meta]) => meta.category === key);
|
|
181
|
-
if (cat_commands.length === 0)
|
|
182
|
-
continue;
|
|
183
|
-
lines.push(`${c.yellow}${title}${c.reset}:`);
|
|
184
|
-
cat_commands.sort(([a], [b]) => a.localeCompare(b));
|
|
185
|
-
const max_usage_width = to_max_length(cat_commands, ([_, meta]) => ` ${meta.usage}`);
|
|
186
|
-
for (const [_, meta] of cat_commands) {
|
|
187
|
-
const padded = ` ${meta.usage}`.padEnd(Math.max(max_usage_width + 2, 40));
|
|
188
|
-
lines.push(`${padded}${meta.summary}`);
|
|
189
|
-
}
|
|
190
|
-
lines.push('');
|
|
191
|
-
}
|
|
192
|
-
// global options
|
|
193
|
-
lines.push(`${c.yellow}OPTIONS${c.reset}:`);
|
|
194
|
-
for (const opt_line of generate_global_options()) {
|
|
195
|
-
lines.push(opt_line);
|
|
196
|
-
}
|
|
197
|
-
lines.push('');
|
|
198
|
-
// examples
|
|
199
|
-
if (options.examples.length > 0) {
|
|
200
|
-
lines.push(`${c.yellow}EXAMPLES${c.reset}:`);
|
|
201
|
-
for (const example of options.examples) {
|
|
202
|
-
lines.push(` ${example}`);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
return lines.join('\n');
|
|
206
|
-
};
|
|
207
|
-
const get_help_text = (command, subcommand) => {
|
|
208
|
-
const cmd_key = subcommand ? `${command} ${subcommand}` : command;
|
|
209
|
-
if (cmd_key && options.commands[cmd_key]) {
|
|
210
|
-
return generate_command_help(cmd_key, options.commands[cmd_key]);
|
|
211
|
-
}
|
|
212
|
-
return generate_main_help();
|
|
213
|
-
};
|
|
214
|
-
return { generate_main_help, generate_command_help, get_help_text };
|
|
215
|
-
};
|