sanka-cli 0.2.13__tar.gz → 0.2.14__tar.gz
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.
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/.gitignore +2 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/PKG-INFO +2 -2
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/README.md +1 -1
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/pyproject.toml +1 -1
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/cli/__init__.py +0 -101
- sanka_cli-0.2.14/src/sanka/cli/_research.py +138 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_cli/__init__.py +1 -1
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_cli/commands/auth.py +6 -1
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_cli/commands/cloud.py +4 -2
- sanka_cli-0.2.14/src/sanka_cli/commands/fix.py +255 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_cli/commands/migrate.py +0 -1
- sanka_cli-0.2.14/src/sanka_cli/commands/workflow_templates.py +92 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_cli/commands/workflows.py +43 -2
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_cli/main.py +2 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_cli.py +15 -109
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_hosted_cli.py +17 -8
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_mcp_retirement.py +1 -1
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_sanka_facade.py +1 -1
- sanka_cli-0.2.14/tests/test_workflow_templates_cli.py +162 -0
- sanka_cli-0.2.13/src/sanka/cli/_research.py +0 -329
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/LICENSES/AGPL-3.0-only.txt +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/LICENSES/Apache-2.0.txt +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/NOTICE +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/__init__.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/_client.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/cli/_compact.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/cli/_output.py +0 -0
- {sanka_cli-0.2.13/src/sanka_extensions/systems → sanka_cli-0.2.14/src/sanka/cli}/py.typed +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/connector/__init__.py +0 -0
- {sanka_cli-0.2.13/src/sanka_extensions → sanka_cli-0.2.14/src/sanka/connector}/py.typed +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/__about__.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/__init__.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/concurrency.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/connector_client.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/connector_host.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/engine.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/execution/__init__.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/execution/continuous.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/execution/errors.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/execution/local.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/execution/model.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/execution/report_codec.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/execution/routes.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/execution/scope.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/execution/state.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/execution/validate.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/extensions/__init__.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/extensions/artifacts.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/extensions/code_lifecycle.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/extensions/code_repair.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/extensions/discovery.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/extensions/lifecycle.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/extensions/model.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/extensions/runner.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/extensions/stage.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/extensions/store.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/flow/__init__.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/flow/extension.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/flow/host.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/flow/lifecycle.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/flow/merge.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/flow/model.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/flow/planner.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/flow/sqlite.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/flow/state.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/flow/verification.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/hashing.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/mapping/__init__.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/mapping/errors.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/mapping/mapping_candidates.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/mapping/model.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/mapping/owner_mapping.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/mapping/pending_relationships.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/mapping/record_mapping.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/planner.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/private_sqlite.py +0 -0
- {sanka_cli-0.2.13/src/sanka_extensions/data → sanka_cli-0.2.14/src/sanka/runtime}/py.typed +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/registry.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/safe_local_io.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/spec.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka/runtime/state.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_cli/__main__.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_cli/bundle.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_cli/certificates.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_cli/client.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_cli/commands/__init__.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_cli/commands/ai.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_cli/commands/cloud_fleet.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_cli/commands/cloud_migrate.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_cli/commands/code.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_cli/commands/doctor.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_cli/commands/functions.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_cli/commands/profiles.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_cli/commands/resources.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_cli/commands/skill.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_cli/config.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_cli/output.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_cli/runtime.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_cli/skills/sanka-cli/SKILL.md +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_cli/state.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_connector/__about__.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_connector/__init__.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_connector/credentials.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_connector/errors.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_connector/protocols.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_connector/provisioning.py +0 -0
- {sanka_cli-0.2.13/src/sanka_extension_sdk → sanka_cli-0.2.14/src/sanka_connector}/py.typed +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_connector/records.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_connector/registration.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_connector/schema.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extension_sdk/__init__.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extension_sdk/contract.py +0 -0
- {sanka_cli-0.2.13/src/sanka_connector → sanka_cli-0.2.14/src/sanka_extension_sdk}/py.typed +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/__init__.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/code/__init__.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/code/contract.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/data/__about__.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/data/__init__.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/data/credentials.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/data/errors.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/data/protocols.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/data/provisioning.py +0 -0
- {sanka_cli-0.2.13/src/sanka/runtime → sanka_cli-0.2.14/src/sanka_extensions/data}/py.typed +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/data/records.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/data/registration.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/data/schema.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/flow/__init__.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/flow/_wire.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/flow/blueprint.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/flow/definition.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/flow/graph.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/flow/identity.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/flow/native.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/flow/protocol.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/flow/scenario.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/flow/source.py +0 -0
- {sanka_cli-0.2.13/src/sanka/connector → sanka_cli-0.2.14/src/sanka_extensions}/py.typed +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/systems/__about__.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/systems/__init__.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/systems/credentials.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/systems/errors.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/systems/protocols.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/systems/provisioning.py +0 -0
- {sanka_cli-0.2.13/src/sanka/cli → sanka_cli-0.2.14/src/sanka_extensions/systems}/py.typed +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/systems/records.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/systems/registration.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/src/sanka_extensions/systems/schema.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/conftest.py +0 -0
- {sanka_cli-0.2.13/tests/fixtures/extension_drf_project/config → sanka_cli-0.2.14/tests/fixtures/extension_drf_project/api}/__init__.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/fixtures/extension_drf_project/api/serializers.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/fixtures/extension_drf_project/api/views.py +0 -0
- {sanka_cli-0.2.13/tests/fixtures/extension_drf_project/api → sanka_cli-0.2.14/tests/fixtures/extension_drf_project/config}/__init__.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/fixtures/extension_drf_project/config/settings.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/fixtures/extension_drf_project/config/urls.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/fixtures/extension_drf_project/manage.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/fixtures/extension_marketplace/drf-to-fastapi.json +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/fixtures/extension_marketplace/marketplace.json +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/fixtures/flow/synthetic_native_order_billing_blueprint.json +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/fixtures/flow/synthetic_sales_created_estimate_blueprint.json +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/fixtures/flow/synthetic_sales_quote_blueprint.json +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/flow_wheel_acceptance.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_business_flow_extension_acceptance.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_cli_developer_experience.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_code_bundle.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_code_commands.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_code_lifecycle.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_code_repair.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_concurrency.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_connector_client.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_connector_host.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_credential_provider.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_doctor.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_engine_e2e.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_engine_execution_adoption.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_engine_pg_to_clickhouse_e2e.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_engine_postgres_e2e.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_execution_continuous.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_execution_exact_scope.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_execution_local_store.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_execution_report_codec.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_execution_routes.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_execution_scope.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_execution_seam.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_execution_validate.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_extension_discovery.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_extension_lifecycle.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_extension_runner.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_extension_stage.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_extension_store.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_extension_wheel_acceptance.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_flow_extension.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_flow_extension_wheel_acceptance.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_flow_lifecycle.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_flow_merge.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_flow_planner.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_flow_sdk_codec.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_flow_sqlite.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_flow_verification.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_hashing.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_mapping_candidates.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_mapping_owner_mapping.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_mapping_pending_relationships.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_mapping_record_mapping.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_planner.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_registry.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_safe_local_io.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_skill_commands.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_spec.py +0 -0
- {sanka_cli-0.2.13 → sanka_cli-0.2.14}/tests/test_state_store.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: sanka-cli
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.14
|
|
4
4
|
Summary: Sanka command-line interface and migration runtime
|
|
5
5
|
Project-URL: Repository, https://github.com/sankaHQ/sanka
|
|
6
6
|
Project-URL: Issues, https://github.com/sankaHQ/sanka/issues
|
|
@@ -123,7 +123,7 @@ Custom functions use `sanka functions`; the old `sanka code` group keeps its ori
|
|
|
123
123
|
function operations as a compatibility alias. Sanka Code migration commands remain
|
|
124
124
|
`scan`, `plan`, `apply`, `test`, and `verify`.
|
|
125
125
|
|
|
126
|
-
`--base-url` also selects the API origin for anonymous
|
|
126
|
+
`--base-url` also selects the API origin for the anonymous assessment. A full
|
|
127
127
|
migration-service URL in `SANKA_MIGRATE_API_BASE` is retained as a fallback.
|
|
128
128
|
|
|
129
129
|
## Hosted repository runs
|
|
@@ -96,7 +96,7 @@ Custom functions use `sanka functions`; the old `sanka code` group keeps its ori
|
|
|
96
96
|
function operations as a compatibility alias. Sanka Code migration commands remain
|
|
97
97
|
`scan`, `plan`, `apply`, `test`, and `verify`.
|
|
98
98
|
|
|
99
|
-
`--base-url` also selects the API origin for anonymous
|
|
99
|
+
`--base-url` also selects the API origin for the anonymous assessment. A full
|
|
100
100
|
migration-service URL in `SANKA_MIGRATE_API_BASE` is retained as a fallback.
|
|
101
101
|
|
|
102
102
|
## Hosted repository runs
|
|
@@ -44,7 +44,6 @@ from sanka.cli._output import TerminalOutput
|
|
|
44
44
|
from sanka.cli._research import (
|
|
45
45
|
SankaMigrateApiClient,
|
|
46
46
|
SankaMigrateApiError,
|
|
47
|
-
print_research,
|
|
48
47
|
signup_url,
|
|
49
48
|
)
|
|
50
49
|
from sanka.runtime.__about__ import __version__
|
|
@@ -557,36 +556,6 @@ def _build_parser(*, json_errors: bool = False) -> argparse.ArgumentParser:
|
|
|
557
556
|
connect.add_argument("--json", action="store_true", help="print provider details as JSON")
|
|
558
557
|
connect.set_defaults(handler=_cmd_connect)
|
|
559
558
|
|
|
560
|
-
research = commands.add_parser(
|
|
561
|
-
"research",
|
|
562
|
-
help="query cited Sanka lifecycle, cost, and comparison research",
|
|
563
|
-
)
|
|
564
|
-
research_commands = research.add_subparsers(dest="research_command", required=True)
|
|
565
|
-
|
|
566
|
-
eol = research_commands.add_parser("eol", help="query software lifecycle events")
|
|
567
|
-
eol.add_argument("product", nargs="?")
|
|
568
|
-
eol.add_argument("--category")
|
|
569
|
-
eol.add_argument(
|
|
570
|
-
"--type",
|
|
571
|
-
choices=("shutdown", "end_of_support", "maintenance_end", "version_lifecycle"),
|
|
572
|
-
)
|
|
573
|
-
eol.add_argument("--after", help="inclusive YYYY-MM lower bound")
|
|
574
|
-
eol.add_argument("--before", help="inclusive YYYY-MM upper bound")
|
|
575
|
-
_research_output_options(eol)
|
|
576
|
-
eol.set_defaults(handler=_cmd_research_eol)
|
|
577
|
-
|
|
578
|
-
tco = research_commands.add_parser("tco", help="query published cost benchmarks")
|
|
579
|
-
tco.add_argument("product", nargs="?")
|
|
580
|
-
tco.add_argument("--category")
|
|
581
|
-
_research_output_options(tco)
|
|
582
|
-
tco.set_defaults(handler=_cmd_research_tco)
|
|
583
|
-
|
|
584
|
-
compare = research_commands.add_parser("compare", help="compare migration capabilities")
|
|
585
|
-
compare.add_argument("category")
|
|
586
|
-
compare.add_argument("--platforms", help="comma-separated platform slugs (maximum 10)")
|
|
587
|
-
_research_output_options(compare)
|
|
588
|
-
compare.set_defaults(handler=_cmd_research_compare)
|
|
589
|
-
|
|
590
559
|
assess = commands.add_parser("assess", help="submit a free migration assessment")
|
|
591
560
|
assess.add_argument("--source")
|
|
592
561
|
assess.add_argument("--destination")
|
|
@@ -667,11 +636,6 @@ def _set_json_errors(parser: argparse.ArgumentParser, enabled: bool) -> None:
|
|
|
667
636
|
_set_json_errors(child, enabled)
|
|
668
637
|
|
|
669
638
|
|
|
670
|
-
def _research_output_options(parser: argparse.ArgumentParser) -> None:
|
|
671
|
-
parser.add_argument("--lang", choices=("en", "ja"), dest="locale")
|
|
672
|
-
parser.add_argument("--json", action="store_true", help="print the API data payload as JSON")
|
|
673
|
-
|
|
674
|
-
|
|
675
639
|
def _research_client(api_base: str | None = None) -> SankaMigrateApiClient:
|
|
676
640
|
# The shared CLI option names an API origin (optionally with a path prefix).
|
|
677
641
|
# The older SANKA_MIGRATE_API_BASE setting continues to name the full service root.
|
|
@@ -1168,44 +1132,6 @@ async def _cmd_migrate(args: argparse.Namespace) -> int:
|
|
|
1168
1132
|
return 0 if report.ok else 1
|
|
1169
1133
|
|
|
1170
1134
|
|
|
1171
|
-
async def _cmd_research_eol(args: argparse.Namespace) -> int:
|
|
1172
|
-
data = await asyncio.to_thread(
|
|
1173
|
-
_research_client(getattr(args, "api_base", None)).research_eol,
|
|
1174
|
-
product=args.product,
|
|
1175
|
-
category=args.category,
|
|
1176
|
-
event_type=args.type,
|
|
1177
|
-
after=args.after,
|
|
1178
|
-
before=args.before,
|
|
1179
|
-
locale=args.locale,
|
|
1180
|
-
)
|
|
1181
|
-
return _print_research_result(data, kind="eol", locale=args.locale, as_json=args.json)
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
async def _cmd_research_tco(args: argparse.Namespace) -> int:
|
|
1185
|
-
data = await asyncio.to_thread(
|
|
1186
|
-
_research_client(getattr(args, "api_base", None)).research_tco,
|
|
1187
|
-
product=args.product,
|
|
1188
|
-
category=args.category,
|
|
1189
|
-
locale=args.locale,
|
|
1190
|
-
)
|
|
1191
|
-
return _print_research_result(data, kind="tco", locale=args.locale, as_json=args.json)
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
async def _cmd_research_compare(args: argparse.Namespace) -> int:
|
|
1195
|
-
if args.platforms and len([item for item in args.platforms.split(",") if item.strip()]) > 10:
|
|
1196
|
-
raise SankaMigrateApiError(
|
|
1197
|
-
"SANKA_MIGRATE_INPUT_INVALID",
|
|
1198
|
-
"--platforms accepts at most 10 comma-separated values.",
|
|
1199
|
-
)
|
|
1200
|
-
data = await asyncio.to_thread(
|
|
1201
|
-
_research_client(getattr(args, "api_base", None)).research_compare,
|
|
1202
|
-
category=args.category,
|
|
1203
|
-
platforms=args.platforms,
|
|
1204
|
-
locale=args.locale,
|
|
1205
|
-
)
|
|
1206
|
-
return _print_research_result(data, kind="compare", locale=args.locale, as_json=args.json)
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
1135
|
async def _cmd_assess(args: argparse.Namespace) -> int:
|
|
1210
1136
|
answers = [
|
|
1211
1137
|
args.source,
|
|
@@ -1259,33 +1185,6 @@ async def _cmd_assess(args: argparse.Namespace) -> int:
|
|
|
1259
1185
|
return 0
|
|
1260
1186
|
|
|
1261
1187
|
|
|
1262
|
-
def _print_research_result(
|
|
1263
|
-
data: dict[str, Any],
|
|
1264
|
-
*,
|
|
1265
|
-
kind: str,
|
|
1266
|
-
locale: str | None,
|
|
1267
|
-
as_json: bool,
|
|
1268
|
-
) -> int:
|
|
1269
|
-
if as_json:
|
|
1270
|
-
print(json.dumps(data, ensure_ascii=False, indent=2))
|
|
1271
|
-
return 0 if _research_has_results(data, kind=kind) else 2
|
|
1272
|
-
return print_research(data, kind=kind, locale=locale)
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
def _research_has_results(data: dict[str, Any], *, kind: str) -> bool:
|
|
1276
|
-
if kind == "eol":
|
|
1277
|
-
if isinstance(data.get("events"), list):
|
|
1278
|
-
return bool(data["events"])
|
|
1279
|
-
product = data.get("product")
|
|
1280
|
-
return isinstance(product, dict) and bool(product.get("events"))
|
|
1281
|
-
if kind == "tco":
|
|
1282
|
-
if isinstance(data.get("benchmarks"), list):
|
|
1283
|
-
return bool(data["benchmarks"])
|
|
1284
|
-
product = data.get("product")
|
|
1285
|
-
return isinstance(product, dict) and bool(product.get("plans"))
|
|
1286
|
-
return bool(data.get("platforms"))
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
1188
|
def _infer_endpoint(value: str, *, role: str) -> EndpointSpec:
|
|
1290
1189
|
"""Map a CLI shorthand to an endpoint: paths → file connectors, URL
|
|
1291
1190
|
schemes → the connector named by the scheme."""
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
"""HTTP helpers for the credential-free Sanka assessment endpoint."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import json
|
|
7
|
+
import os
|
|
8
|
+
from collections.abc import Callable, Mapping
|
|
9
|
+
from typing import Any, Protocol, cast
|
|
10
|
+
from urllib.error import HTTPError, URLError
|
|
11
|
+
from urllib.parse import urlencode
|
|
12
|
+
from urllib.request import Request, urlopen
|
|
13
|
+
|
|
14
|
+
from sanka_cli import __version__
|
|
15
|
+
|
|
16
|
+
DEFAULT_API_BASE = "https://api.sanka.com/v2/migrate"
|
|
17
|
+
DEFAULT_SIGNUP_BASE = "https://app.sanka.com"
|
|
18
|
+
DEFAULT_TIMEOUT_SECONDS = 10.0
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class _HttpResponse(Protocol):
|
|
22
|
+
headers: Mapping[str, str]
|
|
23
|
+
|
|
24
|
+
def read(self) -> bytes: ...
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
_Opener = Callable[..., Any]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class SankaMigrateApiError(Exception):
|
|
31
|
+
"""A transport or standard-envelope error returned by the public API."""
|
|
32
|
+
|
|
33
|
+
def __init__(self, code: str, message: str, *, retry_after: str | None = None) -> None:
|
|
34
|
+
super().__init__(message)
|
|
35
|
+
self.code = code
|
|
36
|
+
self.message = message
|
|
37
|
+
self.retry_after = retry_after
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class SankaMigrateApiClient:
|
|
41
|
+
def __init__(
|
|
42
|
+
self,
|
|
43
|
+
*,
|
|
44
|
+
base_url: str | None = None,
|
|
45
|
+
timeout: float = DEFAULT_TIMEOUT_SECONDS,
|
|
46
|
+
opener: _Opener = urlopen,
|
|
47
|
+
) -> None:
|
|
48
|
+
configured_base = base_url or os.environ.get("SANKA_MIGRATE_API_BASE") or DEFAULT_API_BASE
|
|
49
|
+
self._base_url = configured_base.rstrip("/")
|
|
50
|
+
self._timeout = timeout
|
|
51
|
+
self._opener = opener
|
|
52
|
+
|
|
53
|
+
def assess(self, payload: dict[str, Any]) -> dict[str, Any]:
|
|
54
|
+
return self._request("POST", "/assessments", payload=payload)
|
|
55
|
+
|
|
56
|
+
def _request(
|
|
57
|
+
self,
|
|
58
|
+
method: str,
|
|
59
|
+
path: str,
|
|
60
|
+
*,
|
|
61
|
+
query: Mapping[str, str | None] | None = None,
|
|
62
|
+
payload: dict[str, Any] | None = None,
|
|
63
|
+
) -> dict[str, Any]:
|
|
64
|
+
params = {key: value for key, value in (query or {}).items() if value not in (None, "")}
|
|
65
|
+
suffix = f"?{urlencode(params)}" if params else ""
|
|
66
|
+
body = json.dumps(payload).encode("utf-8") if payload is not None else None
|
|
67
|
+
headers = {"Accept": "application/json", "User-Agent": f"sanka-cli/{__version__}"}
|
|
68
|
+
if body is not None:
|
|
69
|
+
headers["Content-Type"] = "application/json"
|
|
70
|
+
request = Request(
|
|
71
|
+
f"{self._base_url}{path}{suffix}",
|
|
72
|
+
data=body,
|
|
73
|
+
headers=headers,
|
|
74
|
+
method=method,
|
|
75
|
+
)
|
|
76
|
+
try:
|
|
77
|
+
with self._opener(request, timeout=self._timeout) as response:
|
|
78
|
+
envelope = _decode_json(response.read())
|
|
79
|
+
except HTTPError as error:
|
|
80
|
+
envelope = _decode_json(error.read(), fallback={})
|
|
81
|
+
details = _error_details(envelope)
|
|
82
|
+
retry_after = error.headers.get("Retry-After") if error.headers else None
|
|
83
|
+
raise SankaMigrateApiError(
|
|
84
|
+
details["code"],
|
|
85
|
+
details["message"],
|
|
86
|
+
retry_after=retry_after,
|
|
87
|
+
) from error
|
|
88
|
+
except (URLError, TimeoutError, OSError) as error:
|
|
89
|
+
raise SankaMigrateApiError(
|
|
90
|
+
"SANKA_MIGRATE_API_UNAVAILABLE",
|
|
91
|
+
f"Sanka API request failed: {error}",
|
|
92
|
+
) from error
|
|
93
|
+
if not isinstance(envelope, dict) or envelope.get("success") is not True:
|
|
94
|
+
details = _error_details(envelope)
|
|
95
|
+
raise SankaMigrateApiError(details["code"], details["message"])
|
|
96
|
+
data = envelope.get("data")
|
|
97
|
+
if not isinstance(data, dict):
|
|
98
|
+
raise SankaMigrateApiError(
|
|
99
|
+
"SANKA_MIGRATE_API_INVALID_RESPONSE",
|
|
100
|
+
"Sanka API returned an invalid response.",
|
|
101
|
+
)
|
|
102
|
+
return cast(dict[str, Any], data)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def signup_url(assessment_id: str, *, lang: str) -> str:
|
|
106
|
+
base = (os.environ.get("SANKA_MIGRATE_SIGNUP_BASE") or DEFAULT_SIGNUP_BASE).rstrip("/")
|
|
107
|
+
signup_path = "/ja/signup" if lang == "ja" else "/register"
|
|
108
|
+
handoff = urlencode({"lang": lang, "assessment_id": assessment_id})
|
|
109
|
+
return f"{base}{signup_path}?{urlencode({'next': f'/migrate-onboarding?{handoff}'})}"
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def _decode_json(raw: bytes, *, fallback: Any = None) -> Any:
|
|
113
|
+
try:
|
|
114
|
+
return json.loads(raw.decode("utf-8"))
|
|
115
|
+
except (UnicodeDecodeError, json.JSONDecodeError):
|
|
116
|
+
return fallback
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def _error_details(envelope: Any) -> dict[str, str]:
|
|
120
|
+
error = envelope.get("error") if isinstance(envelope, dict) else None
|
|
121
|
+
if not isinstance(error, dict):
|
|
122
|
+
return {
|
|
123
|
+
"code": "SANKA_MIGRATE_API_ERROR",
|
|
124
|
+
"message": "Sanka API request failed.",
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
"code": str(error.get("code") or "SANKA_MIGRATE_API_ERROR"),
|
|
128
|
+
"message": str(error.get("message") or "Sanka API request failed."),
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
__all__ = [
|
|
133
|
+
"DEFAULT_API_BASE",
|
|
134
|
+
"DEFAULT_SIGNUP_BASE",
|
|
135
|
+
"SankaMigrateApiClient",
|
|
136
|
+
"SankaMigrateApiError",
|
|
137
|
+
"signup_url",
|
|
138
|
+
]
|
|
@@ -14,7 +14,12 @@ def auth() -> None:
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
@auth.command("login")
|
|
17
|
-
@click.option(
|
|
17
|
+
@click.option(
|
|
18
|
+
"--access-token",
|
|
19
|
+
prompt="Developer API access token",
|
|
20
|
+
hide_input=True,
|
|
21
|
+
help="Developer API access token (hidden prompt when omitted).",
|
|
22
|
+
)
|
|
18
23
|
@click.option(
|
|
19
24
|
"--refresh-token",
|
|
20
25
|
default=None,
|
|
@@ -64,7 +64,7 @@ def _read(state: CLIState, workspace: str, path: str, **params: Any) -> dict[str
|
|
|
64
64
|
|
|
65
65
|
@click.group()
|
|
66
66
|
def cloud() -> None:
|
|
67
|
-
"""Hosted
|
|
67
|
+
"""Hosted migration and Sanka Fix runs, credit receipts, and artifacts."""
|
|
68
68
|
|
|
69
69
|
|
|
70
70
|
cloud.add_command(fleet)
|
|
@@ -518,7 +518,7 @@ def cancel(state: CLIState, workspace: str, run_id: Any) -> None:
|
|
|
518
518
|
@RUN
|
|
519
519
|
@click.option(
|
|
520
520
|
"--artifact",
|
|
521
|
-
|
|
521
|
+
help="Exact name from the run artifact manifest (including Sanka Code/Fix artifacts).",
|
|
522
522
|
default="output.zip",
|
|
523
523
|
)
|
|
524
524
|
@click.option("--to", "destination", required=True, type=click.Path(dir_okay=False, path_type=Path))
|
|
@@ -527,6 +527,8 @@ def download(
|
|
|
527
527
|
state: CLIState, workspace: str, run_id: Any, artifact: str, destination: Path
|
|
528
528
|
) -> None:
|
|
529
529
|
"""Verify a retained artifact's digest and save a new file; existing files are preserved."""
|
|
530
|
+
if not re.fullmatch(r"[A-Za-z0-9][A-Za-z0-9_.-]{0,199}", artifact):
|
|
531
|
+
raise click.BadParameter("must be an artifact filename", param_hint="--artifact")
|
|
530
532
|
if destination.exists() or destination.is_symlink():
|
|
531
533
|
raise click.ClickException("Destination already exists; choose a new file")
|
|
532
534
|
manifest = _data(_read(state, workspace, f"{ROOT}/{run_id}/artifacts"))
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
"""Authenticated Sanka Fix client. Execution remains in Sanka Cloud."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import hashlib
|
|
7
|
+
import json
|
|
8
|
+
import os
|
|
9
|
+
import sys
|
|
10
|
+
import time
|
|
11
|
+
from contextlib import suppress
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
from typing import Any
|
|
14
|
+
from uuid import uuid4
|
|
15
|
+
|
|
16
|
+
import click
|
|
17
|
+
import httpx
|
|
18
|
+
|
|
19
|
+
import sanka_cli.runtime as runtime
|
|
20
|
+
from sanka_cli.commands.cloud import ROOT, WORKSPACE, _data, _digest, _headers, _intent_key, _read
|
|
21
|
+
from sanka_cli.config import config_path
|
|
22
|
+
from sanka_cli.state import CLIState
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _interactive() -> bool:
|
|
26
|
+
return sys.stdin.isatty()
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _intent_path(binding: dict[str, Any], key: str | None) -> Path:
|
|
30
|
+
fingerprint = hashlib.sha256(json.dumps([binding, key], sort_keys=True).encode()).hexdigest()
|
|
31
|
+
return config_path().parent / "fix-intents" / f"{fingerprint}.json"
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _saved_intent(binding: dict[str, Any], key: str | None) -> dict[str, Any] | None:
|
|
35
|
+
path = _intent_path(binding, key)
|
|
36
|
+
try:
|
|
37
|
+
saved = json.loads(path.read_text(encoding="utf-8"))
|
|
38
|
+
except FileNotFoundError:
|
|
39
|
+
return None
|
|
40
|
+
except (OSError, ValueError) as exc:
|
|
41
|
+
raise click.ClickException(
|
|
42
|
+
"Cannot read saved Fix intent; do not submit a new intent"
|
|
43
|
+
) from exc
|
|
44
|
+
if (
|
|
45
|
+
not isinstance(saved, dict)
|
|
46
|
+
or not isinstance(saved.get("request"), dict)
|
|
47
|
+
or not isinstance(saved.get("idempotency_key"), str)
|
|
48
|
+
or not isinstance(saved["request"].get("candidate_sha256"), str)
|
|
49
|
+
or saved.get("binding") != binding
|
|
50
|
+
or type(saved["request"].get("max_credits")) is not int
|
|
51
|
+
or saved["request"]["max_credits"] != binding["max_credits"]
|
|
52
|
+
):
|
|
53
|
+
raise click.ClickException("Invalid saved Fix intent; do not submit a new intent")
|
|
54
|
+
_intent_key(saved["idempotency_key"])
|
|
55
|
+
_digest(saved["request"]["candidate_sha256"])
|
|
56
|
+
return saved
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _save_intent(binding: dict[str, Any], body: dict[str, Any], key: str | None) -> dict[str, Any]:
|
|
60
|
+
"""Persist consent and exact body before sending, atomically even for concurrent clients."""
|
|
61
|
+
path = _intent_path(binding, key)
|
|
62
|
+
actual_key = key or str(uuid4())
|
|
63
|
+
directory = path.parent
|
|
64
|
+
directory.mkdir(mode=0o700, parents=True, exist_ok=True)
|
|
65
|
+
temporary = directory / f".{uuid4()}.tmp"
|
|
66
|
+
try:
|
|
67
|
+
with temporary.open("x", encoding="utf-8") as stream:
|
|
68
|
+
os.chmod(temporary, 0o600)
|
|
69
|
+
json.dump({"idempotency_key": actual_key, "binding": binding, "request": body}, stream)
|
|
70
|
+
stream.flush()
|
|
71
|
+
os.fsync(stream.fileno())
|
|
72
|
+
with suppress(FileExistsError):
|
|
73
|
+
os.link(temporary, path)
|
|
74
|
+
saved = _saved_intent(binding, key)
|
|
75
|
+
assert saved is not None
|
|
76
|
+
# An explicit retry of an automatically generated key finds the same durable request.
|
|
77
|
+
with suppress(FileExistsError):
|
|
78
|
+
os.link(path, _intent_path(binding, saved["idempotency_key"]))
|
|
79
|
+
descriptor = os.open(directory, os.O_RDONLY)
|
|
80
|
+
try:
|
|
81
|
+
os.fsync(descriptor)
|
|
82
|
+
finally:
|
|
83
|
+
os.close(descriptor)
|
|
84
|
+
return saved
|
|
85
|
+
except OSError as exc:
|
|
86
|
+
raise click.ClickException("Cannot durably save Fix intent; nothing was submitted") from exc
|
|
87
|
+
finally:
|
|
88
|
+
temporary.unlink(missing_ok=True)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _exit_code(run: dict[str, Any]) -> int | None:
|
|
92
|
+
status = run.get("status")
|
|
93
|
+
if status not in {"succeeded", "failed", "cancelled"}:
|
|
94
|
+
return None
|
|
95
|
+
outcome = (run.get("fix_result") or {}).get("outcome")
|
|
96
|
+
if status == "cancelled" or outcome == "cancelled":
|
|
97
|
+
return 5
|
|
98
|
+
if status == "succeeded" and outcome == "checks_passed":
|
|
99
|
+
return 0
|
|
100
|
+
if outcome in {"setup_required", "service_error"}:
|
|
101
|
+
return 4
|
|
102
|
+
if outcome in {"needs_review", "budget_reached"} or status == "succeeded":
|
|
103
|
+
return 3
|
|
104
|
+
return 4
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def _follow(state: CLIState, workspace: str, run: dict[str, Any], seconds: int) -> None:
|
|
108
|
+
deadline = time.monotonic() + seconds
|
|
109
|
+
code = _exit_code(run)
|
|
110
|
+
previous_status = run.get("status")
|
|
111
|
+
if _interactive():
|
|
112
|
+
click.echo(f"Fix status: {previous_status}", err=True)
|
|
113
|
+
try:
|
|
114
|
+
while code is None and time.monotonic() < deadline:
|
|
115
|
+
time.sleep(min(2, max(0, deadline - time.monotonic())))
|
|
116
|
+
run = _data(_read(state, workspace, f"{ROOT}/{run['id']}"))
|
|
117
|
+
code = _exit_code(run)
|
|
118
|
+
if _interactive() and run.get("status") != previous_status:
|
|
119
|
+
previous_status = run.get("status")
|
|
120
|
+
click.echo(f"Fix status: {previous_status}", err=True)
|
|
121
|
+
except KeyboardInterrupt:
|
|
122
|
+
run["client_state"] = "detached"
|
|
123
|
+
runtime.emit_payload(run, state)
|
|
124
|
+
raise SystemExit(130) from None
|
|
125
|
+
run["client_state"] = "settled" if code is not None else "wait_timeout"
|
|
126
|
+
run["receipt_command"] = f"sanka cloud receipt --workspace {workspace} {run['id']}"
|
|
127
|
+
runtime.emit_payload(run, state)
|
|
128
|
+
raise SystemExit(code if code is not None else 6)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
@click.command()
|
|
132
|
+
@click.option("--cloud", "use_cloud", is_flag=True, help="Execute in Sanka Cloud (required).")
|
|
133
|
+
@WORKSPACE
|
|
134
|
+
@click.option(
|
|
135
|
+
"--run", "parent_id", required=True, type=click.UUID, help="Existing Code migration run."
|
|
136
|
+
)
|
|
137
|
+
@click.option(
|
|
138
|
+
"--max-credits", required=True, type=click.IntRange(min=1), help="Maximum total credits."
|
|
139
|
+
)
|
|
140
|
+
@click.option(
|
|
141
|
+
"--yes", is_flag=True, help="Consent to cloud repository excerpts and the credit hold."
|
|
142
|
+
)
|
|
143
|
+
@click.option(
|
|
144
|
+
"--idempotency-key", default=None, help="Required with --yes; reuse after uncertain responses."
|
|
145
|
+
)
|
|
146
|
+
@click.option(
|
|
147
|
+
"--wait", is_flag=True, help="Follow the accepted run; Ctrl-C detaches without cancelling."
|
|
148
|
+
)
|
|
149
|
+
@click.option("--wait-timeout", default=900, show_default=True, type=click.IntRange(1, 3600))
|
|
150
|
+
@click.pass_obj
|
|
151
|
+
def fix(
|
|
152
|
+
state: CLIState,
|
|
153
|
+
use_cloud: bool,
|
|
154
|
+
workspace: str,
|
|
155
|
+
parent_id: Any,
|
|
156
|
+
max_credits: int,
|
|
157
|
+
yes: bool,
|
|
158
|
+
idempotency_key: str | None,
|
|
159
|
+
wait: bool,
|
|
160
|
+
wait_timeout: int,
|
|
161
|
+
) -> None:
|
|
162
|
+
"""Run optional paid Sanka Fix on an eligible retained Sanka Code migration."""
|
|
163
|
+
if not use_cloud:
|
|
164
|
+
raise click.UsageError(
|
|
165
|
+
"Sanka Fix executes in Sanka Cloud. Add --cloud; run sanka login first."
|
|
166
|
+
)
|
|
167
|
+
headers = _headers(workspace)
|
|
168
|
+
if not yes and not _interactive():
|
|
169
|
+
raise click.UsageError("Noninteractive Fix requires --yes and --idempotency-key.")
|
|
170
|
+
if yes and not idempotency_key:
|
|
171
|
+
raise click.UsageError("Automation requires --yes, --max-credits and --idempotency-key.")
|
|
172
|
+
if idempotency_key:
|
|
173
|
+
_intent_key(idempotency_key)
|
|
174
|
+
path = f"{ROOT}/{parent_id}/fix"
|
|
175
|
+
try:
|
|
176
|
+
resolved = runtime.resolve_runtime(
|
|
177
|
+
profile_name=state.profile, base_url_override=state.base_url
|
|
178
|
+
)
|
|
179
|
+
except runtime.CredentialStoreError as exc:
|
|
180
|
+
raise click.ClickException(str(exc)) from exc
|
|
181
|
+
binding = {
|
|
182
|
+
"profile": resolved["profile_name"],
|
|
183
|
+
"base_url": resolved["base_url"],
|
|
184
|
+
"workspace": workspace,
|
|
185
|
+
"parent_run_id": str(parent_id),
|
|
186
|
+
"max_credits": max_credits,
|
|
187
|
+
}
|
|
188
|
+
saved = _saved_intent(binding, idempotency_key)
|
|
189
|
+
if saved is None:
|
|
190
|
+
try:
|
|
191
|
+
eligibility = _data(_read(state, workspace, path))
|
|
192
|
+
except click.ClickException as exc:
|
|
193
|
+
raise click.ClickException(
|
|
194
|
+
f"{exc}. Check your workspace and run sanka login if authentication expired."
|
|
195
|
+
) from exc
|
|
196
|
+
if (
|
|
197
|
+
eligibility.get("parent_run_id") != str(parent_id)
|
|
198
|
+
or str(eligibility.get("workspace_code")) != workspace
|
|
199
|
+
):
|
|
200
|
+
raise click.ClickException(
|
|
201
|
+
"Fix eligibility does not match the selected workspace and run"
|
|
202
|
+
)
|
|
203
|
+
if not eligibility.get("eligible"):
|
|
204
|
+
raise click.ClickException(
|
|
205
|
+
f"Sanka Fix unavailable: {eligibility.get('reason')}. "
|
|
206
|
+
f"{eligibility.get('action') or ''}"
|
|
207
|
+
)
|
|
208
|
+
candidate = _digest(str(eligibility.get("candidate_sha256") or ""))
|
|
209
|
+
if not eligibility["min_credits"] <= max_credits <= eligibility["max_credits"]:
|
|
210
|
+
raise click.BadParameter(
|
|
211
|
+
f"must be {eligibility['min_credits']}-{eligibility['max_credits']} for this run",
|
|
212
|
+
param_hint="--max-credits",
|
|
213
|
+
)
|
|
214
|
+
body = {"candidate_sha256": candidate, "max_credits": max_credits}
|
|
215
|
+
if not yes:
|
|
216
|
+
click.echo(
|
|
217
|
+
f"Sanka Fix: {eligibility.get('workspace_name')} ({workspace}), run {parent_id}\n"
|
|
218
|
+
f"Source: {eligibility.get('source_sha256')}; candidate: {candidate}\n"
|
|
219
|
+
f"Recipe: {eligibility.get('recipe')} ({eligibility.get('recipe_sha256')})\n"
|
|
220
|
+
f"Scope: {eligibility.get('verification_scope')}; provider/model: "
|
|
221
|
+
f"{eligibility.get('provider')}/{eligibility.get('model')}\n"
|
|
222
|
+
f"Worker limits: {json.dumps(eligibility.get('limits'), sort_keys=True)}",
|
|
223
|
+
err=True,
|
|
224
|
+
)
|
|
225
|
+
click.confirm(
|
|
226
|
+
f"Consent to processing repository excerpts in Sanka Cloud and reserving up to "
|
|
227
|
+
f"{max_credits} total credits? This cap is not a fixed price or a repair guarantee",
|
|
228
|
+
abort=True,
|
|
229
|
+
err=True,
|
|
230
|
+
)
|
|
231
|
+
saved = _save_intent(binding, body, idempotency_key)
|
|
232
|
+
else:
|
|
233
|
+
click.echo("Recovering the previously approved Fix intent and exact candidate.", err=True)
|
|
234
|
+
body = saved["request"]
|
|
235
|
+
idempotency_key = saved["idempotency_key"]
|
|
236
|
+
headers["Idempotency-Key"] = idempotency_key
|
|
237
|
+
click.echo(
|
|
238
|
+
f"Fix intent: {idempotency_key}. "
|
|
239
|
+
"Reuse this key and the same inputs after an uncertain response.",
|
|
240
|
+
err=True,
|
|
241
|
+
)
|
|
242
|
+
try:
|
|
243
|
+
run = _data(runtime.request_json(state, "POST", path, headers=headers, json_body=body))
|
|
244
|
+
except httpx.HTTPError as exc:
|
|
245
|
+
raise click.ClickException(
|
|
246
|
+
f"Response uncertain. Retry identical inputs with --idempotency-key {idempotency_key}; "
|
|
247
|
+
"do not use a new key."
|
|
248
|
+
) from exc
|
|
249
|
+
run["idempotency_key"] = idempotency_key
|
|
250
|
+
run["receipt_command"] = f"sanka cloud receipt --workspace {workspace} {run['id']}"
|
|
251
|
+
if wait:
|
|
252
|
+
click.echo(f"Fix run: {run['id']} {run.get('ui_url', '')}", err=True)
|
|
253
|
+
_follow(state, workspace, run, wait_timeout)
|
|
254
|
+
else:
|
|
255
|
+
runtime.emit_payload(run, state)
|
|
@@ -20,7 +20,6 @@ MIGRATION_COMMANDS: dict[str, str] = {
|
|
|
20
20
|
"status": "show run status and ledger counts",
|
|
21
21
|
"migrate": "plan + apply + verify in one go",
|
|
22
22
|
"connect": "inspect installed extension support; does not authenticate a system",
|
|
23
|
-
"research": "query cited Sanka lifecycle, cost, and comparison research",
|
|
24
23
|
"assess": "submit a free migration assessment",
|
|
25
24
|
"extension": "manage data and code extensions",
|
|
26
25
|
}
|