[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7ASP2GNT8M1ZPCJFXQ65E57":3,"skill-same:01M7ASP2GNT8M1ZPCJFXQ65E57":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M7ASP2GNT8M1ZPCJFXQ65E57","vibey-bootstrap-subpackages",null,"Use for vibey-bootstrap v2 Tier 2 \u002F Tier 3 opt-in subpackages, v3.0 runtime modules (db\u002Foutbox, email, http, documentdb, aks, governance, vibey-bootstrap scaffold), and the Python end-to-end recipes. Covers alerts, fastapi_middleware, health, auth (Graph webhook + verify_api_key_header + verify_hmac_signature), ratelimit (TokenBucket, MultiUnitLimiter), retry, ingress, notify, heartbeat, config_refresh, subscription, servicebus (handle_message, async consumer, ReplayGuard, DLQ digest, resubmit tokens), sb_lock, openai, tokens, scheduler, metrics, pdf_safety, db\u002Fget_db\u002FOutbox\u002Fdrain_outbox, AcsEmailSender, hardened HTTP client, AKS SIGTERM\u002Fbuild_info\u002Fleader election, budget_guard, and Terraform\u002FHelm\u002FGitOps scaffold templates. Triggers on vibey_bootstrap subpackage imports, drain_outbox, build_session, install_graph_webhook_route, handle_message, leader_election, or vibey-bootstrap scaffold.","the-vibey-project\u002Fvibey","the-vibey-project","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F329298758?v=4","01M7AJHGZ9722CTJ4JNQZVRH0Q","the vibey project","01M7AJHGZVMG2K7TGXQ6XFHVG3",5,"MIT","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fvibey-bootstrap\u002Fskills\u002Fvibey-bootstrap-subpackages\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: vibey-bootstrap-subpackages\ndescription: \"Use for vibey-bootstrap v2 Tier 2 \u002F Tier 3 opt-in subpackages, v3.0 runtime modules (db\u002Foutbox, email, http, documentdb, aks, governance, vibey-bootstrap scaffold), and the Python end-to-end recipes. Covers alerts, fastapi_middleware, health, auth (Graph webhook + verify_api_key_header + verify_hmac_signature), ratelimit (TokenBucket, MultiUnitLimiter), retry, ingress, notify, heartbeat, config_refresh, subscription, servicebus (handle_message, async consumer, ReplayGuard, DLQ digest, resubmit tokens), sb_lock, openai, tokens, scheduler, metrics, pdf_safety, db\u002Fget_db\u002FOutbox\u002Fdrain_outbox, AcsEmailSender, hardened HTTP client, AKS SIGTERM\u002Fbuild_info\u002Fleader election, budget_guard, and Terraform\u002FHelm\u002FGitOps scaffold templates. Triggers on vibey_bootstrap subpackage imports, drain_outbox, build_session, install_graph_webhook_route, handle_message, leader_election, or vibey-bootstrap scaffold.\"\n---\n\n> **vibey-bootstrap** is the library formerly published as `azure-bootstrap` (renamed in 4.0.0: package `vibey-bootstrap`, import `vibey_bootstrap`, CLI `vibey-bootstrap`; `azbootstrap` remains as a deprecated alias). Feature-tier labels below (v2 primitives, v3 modules) are historical and unchanged.\n\n# Azure Bootstrap — Tier 2 \u002F Tier 3 Subpackages, v3 Runtime & Recipes\n\n## 5. Python: v2 Tier 2 \u002F Tier 3 subpackages (opt-in)\n\nConcise reference; each is an independent import path. See `examples\u002F` for runnable\ndemos (the numbers below reference numbered example files).\n\n### `alerts` — tiered dispatcher\n```python\nfrom vibey_bootstrap.alerts import (\n    register_dispatcher, alert_dev_team, AlertSeverity, install_global_exception_hooks,\n)\nregister_dispatcher(my_email_sender, recipients=[\"dev-alerts@example.com\"])\ninstall_global_exception_hooks()    # uncaught sync\u002Fasync exceptions auto-alert\nalert_dev_team(AlertSeverity.ERROR, subject=\"x failed\", context={...}, dedup_key=\"x\")\n```\n`register_dispatcher(sender, recipients=None)` wires a sender\n(`(recipients, subject, html_body) -> None`); `alert_dev_team(severity, subject,\ncontext=None, dedup_key=None)` fires one. `AlertSeverity` = `WARN | ERROR | CRITICAL`:\n**WARN is log-only**, **ERROR** is logged + queued to the digest and may escalate to\nCRITICAL, **CRITICAL** sends an email immediately (subject to the kill switch +\nrate-limit). `@traced(alert_on_error=...)` and most subpackages emit through this.\nTunables (env): `DEV_ALERTS_ENABLED` (kill switch, default on), `DEV_ALERT_RECIPIENTS`,\n`ALERT_DEDUP_WINDOW_SECONDS` (600), `ALERT_MAX_PER_HOUR` (30), `ALERT_ESCALATE_AFTER`\n(5), `ALERT_ESCALATE_WINDOW_SECONDS` (900), `ALERT_CRITICAL_SUBJECT_PREFIX`.\n\n### `fastapi_middleware` — request timing + 5xx alerts\n```python\nfrom vibey_bootstrap.fastapi_middleware import install_middleware\ninstall_middleware(app, probe_paths=(\"\u002Fhealth\u002Flive\",\"\u002Fhealth\u002Fready\"),\n                   alert_subject_prefix=\"[svc] \", fire_alerts=True)\n```\nProbe paths are **silent**. Non-probes log INFO (`\u003C400`) \u002F WARNING (`>=400`). A `5xx`\nfires an ERROR alert (`http_5xx:{path}:{status}`); an uncaught exception fires\n`http_crash:{path}:{type}` then re-raises. No headers added; correlation lives in\ncontext vars, not HTTP headers.\n\n### `health` — readiness probes\n```python\nfrom vibey_bootstrap.health import (\n    check_app_config_health, check_app_insights_health, check_app_insights_logging,\n)\n```\nEach returns `{\"status\": \"ok\" | \"not_configured\" | \"error\", ...}` (adds `\"mock\": True`\nunder `USE_MOCK_BOOTSTRAP`). `check_app_config_health` does a live App Config load;\nthe App Insights checks are fast readiness checks.\n\n### `auth` — webhook + API-key + HMAC (needs `fastapi` for route helper)\n```python\nfrom vibey_bootstrap.auth import (\n    install_graph_webhook_route, WebhookDedup, verify_api_key_header,\n    verify_webhook_client_state, validation_token_handshake,\n    verify_hmac_signature,   # v3 — GitHub\u002FSumo-style sha256=… bodies\n)\ninstall_graph_webhook_route(app, \"\u002Fapi\u002Fwebhooks\u002Femail\",\n    background_handler=on_message, rate_limit_bucket=webhook_bucket(),\n    dedup=WebhookDedup(ttl_seconds=600))\n```\nHTTP contract is documented in the `vibey-bootstrap-typescript` skill (Part 7).\n`verify_api_key_header(x_api_key, *, env_var=\"API_KEY\", fail_open_when_unset=True)` is\nan async FastAPI dependency raising `HTTPException(401)` on mismatch.\n`verify_hmac_signature(secret, raw_body, header_value)` is constant-time HMAC-SHA256\nfor generic webhook signature headers.\n\n### `ratelimit` — token bucket + multi-unit limiter\n```python\nfrom vibey_bootstrap.ratelimit import (\n    TokenBucket, MultiUnitLimiter, fastapi_rate_limit, webhook_bucket, admin_bucket,\n)\nbucket = TokenBucket(budget=240, refill_per_second=4.0, name=\"webhook\")\nlimiter = MultiUnitLimiter()   # v3 — per-tenant \u002F per-IP composite budgets\n@app.post(\"\u002Fx\", dependencies=[Depends(fastapi_rate_limit(bucket))])\nasync def x(): ...\n```\n```\n`consume(n=1.0) -> bool`; `snapshot()` for monitoring. Presets:\n`webhook_bucket()` = 240 burst \u002F 4 per s; `admin_bucket()` = 30 burst \u002F 0.5 per s.\n`fastapi_rate_limit` returns **429 with an empty body** (no budget leak).\n\n### `retry` — tenacity wrappers (needs `tenacity`)\n```python\nfrom vibey_bootstrap.retry import build_retry, retry_azure_transient, retry_ai_transient\n\n@retry_azure_transient(operation=\"blob.download\")   # 3 attempts, 2–10s, NetworkError|RateLimitError\ndef download(): ...\n\n@retry_ai_transient(operation=\"openai.chat\")        # 7 attempts, 2–120s, RateLimitError\ndef chat(): ...\n```\n\n### `ingress` — 4-gate attachment classifier\n```python\nfrom vibey_bootstrap.ingress import AttachmentClassifier, ClassifiedKind, enforce_zip_safety_limits\n\nresult = AttachmentClassifier().classify(           # gates: extension → MIME → size → magic-byte\n    filename=name, content_type=mime, size_bytes=len(data), content=data,\n)\nif result.allowed:\n    handle(result.kind)        # \"pdf\" | \"zip\"\n```\n`classify(...)` is **keyword-only** and returns\n`ClassificationResult(allowed, kind, reject_reason, extension_mismatch)`.\n`ClassifiedKind` is a **string literal** — `\"pdf\" | \"zip\" | \"reject\"` (the\nclassifier's `allowed_kinds` defaults to `(\"pdf\", \"zip\")`). Zip-bomb defense:\n`enforce_zip_safety_limits(data)` (defaults 500 MB uncompressed \u002F 1000 entries via\n`MAX_ZIP_UNCOMPRESSED_BYTES` and `MAX_ZIP_ENTRIES`).\n\n### `notify` — two-tier notifications\n```python\nfrom vibey_bootstrap.notify import (\n    build_failure_alert_body, build_unprocessable_notification,\n    build_validation_notice_body, should_notify_sender, UnprocessableReason,\n)\n# Builders are keyword-only:\nops_html = build_failure_alert_body(\n    attachment_name=name, correlation_id=cid, sender=addr,\n    error_summary=str(exc)[:500], audience=\"ops\",\n)\nif should_notify_sender(addr):    # per-sender throttle (max_per_hour=3, window_seconds=3600)\n    subject, html, text, reason = build_unprocessable_notification(\n        failure_reason=UnprocessableReason.VALIDATION_FAILURE,\n        sender=addr, attachment_summary=[], correlation_id=cid,\n    )\n```\nOps get full forensics (`build_failure_alert_body`); senders get a sanitized message\n(`build_unprocessable_notification`, which returns a `(subject, html, text, reason)`\ntuple). All builders take **keyword-only** args.\n\n### `heartbeat` — pulse + consumer watchdog\n```python\nfrom vibey_bootstrap.heartbeat import (\n    start_background_monitors, record_consumer_iteration, record_message_settled,\n)\nmonitors = start_background_monitors(stop_event)   # heartbeat + watchdog daemons\n```\nCall `record_consumer_iteration()` each loop; the watchdog fires an ERROR alert after\nsilence (default 30 min). Env: `HEARTBEAT_INTERVAL_SECONDS`,\n`WATCHDOG_INTERVAL_SECONDS`, `WATCHDOG_SB_SILENCE_SECONDS`.\n\n### `config_refresh` — dynamic log flags (run on a schedule)\n```python\nfrom vibey_bootstrap.config_refresh import refresh_log_flags\nrefresh_log_flags((\"DEBUG_LOGGING_ENABLED\", \"LOG_LEVEL\"))   # re-reads App Config; reapplies logging\n```\n\n### `subscription` — resource renewal loop\n```python\nfrom vibey_bootstrap.subscription import ensure_resource, renewal_loop, SubscriptionGone\n```\nIdempotent find-or-create + a SIGTERM-responsive renewal thread (sleeps in ≤5 s\nslices). Built for Graph webhook subscriptions but generic.\n\n### `servicebus` — consumer + DLQ + async extensions (needs `azure-servicebus`)\n```python\nfrom vibey_bootstrap.servicebus import handle_message, run_dlq_digest, issue_resubmit_token\nfrom vibey_bootstrap.servicebus.async_ext import (   # v3\n    run_async_consumer, ReplayGuard, service_bus_transport_type,\n)\nhandle_message(receiver, msg, processor, schema=schema,\n               correlation_field=\"correlation_id\", source=\"consumer\", counter_namespace=\"sb\")\n```\n`handle_message(receiver, msg, processor, *, schema=None, correlation_field=\"correlation_id\",\nextra_correlation_fields=(), source=\"consumer\", counter_namespace=\"sb\")` parses JSON →\nvalidates → opens `correlation_scope` → calls your processor → classifies failures via\n`is_unrecoverable` into **complete \u002F abandon \u002F dead-letter**, and returns\n`(processed: bool, failed: bool)`. `processor` is a `MessageProcessor` Protocol\n(`process(payload)` + `notify_failure(payload, error)`). The DLQ digest\n(`run_dlq_digest`) sends HMAC-signed resubmit tokens —\n`issue_resubmit_token(secret, *, ttl_seconds=86400)` \u002F\n`verify_resubmit_token(secret, token)`.\n\nv3 async helpers: `run_async_consumer(client, queue_name, handler, stop_event=…)` for\nasyncio receive loops; `ReplayGuard` for bounded idempotency; `service_bus_transport_type()`\nreads `SERVICE_BUS_TRANSPORT_TYPE` (`amqp` or `websocket`).\n\n### `sb_lock` — message-lock renewal (needs `azure-servicebus`)\n```python\nfrom vibey_bootstrap.sb_lock import lock_for_process, ManagedLock\nwith lock_for_process(receiver, msg, max_lock_renewal_seconds=3600):\n    ...   # broker won't redeliver mid-process\n```\n\n### `openai` — AI usage tracker\n```python\nfrom vibey_bootstrap.openai import record_usage, acquire, usage_snapshot, check_thresholds_and_alert\nrecord_usage(\"gpt-4o\", prompt_tokens=1200, completion_tokens=300)\n```\nSliding-window tokens + cost (built-in pricing for GPT-4o & Claude 3 families;\noverride via `register_pricing`). Soft TPM cap via `acquire`. Env:\n`AI_TPM_LIMIT[_\u003CDEPLOYMENT>]`, `AI_COST_ALERT_HOURLY_DOLLARS`,\n`AI_COST_ALERT_DAILY_DOLLARS`, `AI_HIGH_USAGE_TOKENS_HOURLY`.\n\n### `tokens` — HMAC-SHA256 action tokens\n```python\nfrom vibey_bootstrap.tokens import issue_action_token, verify_action_token, InvalidActionToken\ntok = issue_action_token(SECRET, action=\"dlq_resubmit\", ttl_seconds=86400, payload={\"id\": \"m1\"})\nbody = verify_action_token(SECRET, tok, expected_action=\"dlq_resubmit\")   # raises InvalidActionToken\n```\nToken = `base64url(json_payload).base64url(hmac_sha256)`; payload carries `exp` (unix\nseconds) + `act`. **This is the interop point for the TS port** (see the\n`vibey-bootstrap-typescript` skill, Part 8).\n\n### `scheduler` — NCRONTAB parser (needs `apscheduler`)\n```python\nfrom vibey_bootstrap.scheduler import parse_cron_trigger\ntrigger = parse_cron_trigger(\"0 *\u002F5 * * * *\")   # 5- or 6-field NCRONTAB → APScheduler CronTrigger\n```\n\n### `metrics` — aggregate snapshot\n```python\nfrom vibey_bootstrap.metrics import build_metrics_snapshot\nsnap = build_metrics_snapshot()\n# {\"latency\": {...}, \"alert_counters\": {...}, \"ai_usage\": {...},\n#  \"bootstrap_initialized\": bool, \"last_sb_settle_age_seconds\": float|None}\n```\nSoft-imports contributors — sections for absent modules are simply omitted.\n\n### `pdf_safety` — strip active content (needs `pypdf`)\n```python\nfrom vibey_bootstrap.pdf_safety import sanitize_pdf_for_passthrough\nreader = sanitize_pdf_for_passthrough(reader)   # removes OpenAction\u002FAA\u002FJavaScript\u002FURI; best-effort\n```\n\n## 6. Python: end-to-end recipes\n\nThese mirror the runnable skeletons in `examples\u002F` — the canonical, tested source. Each\nruns offline with `USE_MOCK_BOOTSTRAP=true ... --dry-run`. Start at `examples\u002FREADME.md`\nfor the full numbered reading order (`01_quickstart.py` … `46_scaffold_cli.py`; v3:\n`39_v3_transports.py`, `44_db_outbox_email.py`, `45_http_client.py`).\n\n### 6.1 Azure Function (`examples\u002Fe2e_azure_function.py`)\n\nLazy idempotent startup, per-request correlation, a fully traced handler, audit lines:\n\n```python\nimport logging, uuid\nfrom vibey_bootstrap.alerts import install_global_exception_hooks, register_dispatcher\nfrom vibey_bootstrap.audit import build_audit_extra\nfrom vibey_bootstrap.bootstrap import ensure_bootstrap\nfrom vibey_bootstrap.counters import bump_counter\nfrom vibey_bootstrap.logging import configure_logging, correlation_scope\nfrom vibey_bootstrap.tracing import traced\n\nlogger = logging.getLogger(__name__)\n_started = False\n\ndef _startup() -> None:\n    global _started\n    if _started:\n        return\n    configure_logging()\n    install_global_exception_hooks()\n    ensure_bootstrap()\n    register_dispatcher(my_email_sender, recipients=[\"dev-alerts@example.com\"])\n    _started = True\n\n@traced(operation=\"example.handle_request\", alert_on_error=\"error\")\ndef handle_request(payload: dict) -> dict:\n    bump_counter(\"example.requests.processed\")\n    return {\"ok\": True}\n\ndef http_handler(request_id: str | None, body: dict) -> dict:\n    _startup()\n    cid = request_id or uuid.uuid4().hex[:12]\n    with correlation_scope(cid, request_id=cid):\n        logger.info(\"REPORT_AUDIT\", extra=build_audit_extra(\"http_request\", method=\"POST\"))\n        return handle_request(body)\n\n# In function_app.py:\n# @app.route(route=\"hello\", auth_level=func.AuthLevel.FUNCTION)\n# def hello(req): return func.HttpResponse(json.dumps(http_handler(req.headers.get(\"X-Request-Id\"), req.get_json())))\n```\n> Note: stdlib `LogRecord` reserves the key `name` — use a different `extra` key\n> (e.g. `payload_name`) when forwarding caller values.\n\n### 6.2 FastAPI pipeline (`examples\u002Fe2e_fastapi_pipeline.py`)\n\nBootstrap + alerts + middleware + webhook + health + API-key admin + `\u002Fapi\u002Fmetrics`:\n\n```python\nfrom fastapi import Depends, FastAPI, Header\nfrom vibey_bootstrap.alerts import install_global_exception_hooks, register_dispatcher\nfrom vibey_bootstrap.auth import WebhookDedup, install_graph_webhook_route, verify_api_key_header\nfrom vibey_bootstrap.bootstrap import ensure_bootstrap\nfrom vibey_bootstrap.fastapi_middleware import install_middleware\nfrom vibey_bootstrap.health import check_app_config_health, check_app_insights_health\nfrom vibey_bootstrap.logging import configure_logging\nfrom vibey_bootstrap.metrics import build_metrics_snapshot\nfrom vibey_bootstrap.ratelimit import admin_bucket, fastapi_rate_limit, webhook_bucket\n\nconfigure_logging(); install_global_exception_hooks(); ensure_bootstrap()\nregister_dispatcher(my_email_sender, recipients=[\"dev-alerts@example.com\"])\n\napp = FastAPI()\ninstall_middleware(app, probe_paths=(\"\u002Fhealth\u002Flive\", \"\u002Fhealth\u002Fready\"))\n\ninstall_graph_webhook_route(app, \"\u002Fapi\u002Fwebhooks\u002Femail\",\n    background_handler=on_message,\n    rate_limit_bucket=webhook_bucket(name=\"email_webhook\"),\n    dedup=WebhookDedup(ttl_seconds=600))\n\n@app.get(\"\u002Fhealth\u002Fready\")\ndef ready() -> dict:\n    return {\"status\": \"ok\",\n            \"app_config\": check_app_config_health(),\n            \"app_insights\": check_app_insights_health()}\n\nadmin_bkt = admin_bucket(name=\"admin_actions\")\n@app.post(\"\u002Fapi\u002Fadmin\u002Freload\", dependencies=[Depends(fastapi_rate_limit(admin_bkt))])\nasync def admin_reload(x_api_key: str = Header(default=None)) -> dict:\n    await verify_api_key_header(x_api_key)\n    return {\"reloaded\": True}\n\n@app.get(\"\u002Fapi\u002Fmetrics\")\ndef metrics() -> dict:\n    return build_metrics_snapshot()\n```\n\n### 6.3 AKS Service Bus worker (`examples\u002Fe2e_aks_sb_worker.py`)\n\nConsumer loop, heartbeat + watchdog, lock-per-message, SIGTERM-clean shutdown. v3 adds\n`install_sigterm_handler`, `build_info`, `pod_context_extra`, and optional\n`leader_election` for singleton schedulers:\n\n```python\nimport threading\nfrom vibey_bootstrap.aks import build_info, install_sigterm_handler, pod_context_extra\nfrom vibey_bootstrap.bootstrap import ensure_bootstrap\nfrom vibey_bootstrap.heartbeat import record_consumer_iteration, start_background_monitors\nfrom vibey_bootstrap.identity import build_credential\nfrom vibey_bootstrap.logging import configure_logging\nfrom vibey_bootstrap.sb_lock import lock_for_process\nfrom vibey_bootstrap.servicebus import handle_message\nfrom vibey_bootstrap.validation import queue_message_schema\n\ndef main_loop(receiver, processor, stop_event):\n    schema = queue_message_schema(required_fields=(\"correlation_id\",),\n                                  path_field=\"blob_path\", path_required_prefix=\"reports\u002F\")\n    while not stop_event.is_set():\n        record_consumer_iteration()\n        msg = receiver.receive()\n        if msg is None:\n            if stop_event.wait(0.1): break\n            continue\n        with lock_for_process(receiver, msg, max_lock_renewal_seconds=3600):\n            handle_message(receiver, msg, processor, schema=schema,\n                           correlation_field=\"correlation_id\", source=\"consumer\", counter_namespace=\"sb\")\n\ndef main_pod():\n    configure_logging(); ensure_bootstrap()\n    logger.info(\"pod starting\", extra={**pod_context_extra(), **build_info()})\n    credential = build_credential()   # WorkloadIdentity in-cluster\n    stop_event = threading.Event()\n    install_sigterm_handler(stop_event)   # v3 — replaces manual signal.signal\n    monitors = start_background_monitors(stop_event)\n    try:\n        main_loop(real_receiver, real_processor, stop_event)\n    finally:\n        stop_event.set()\n        for t in monitors: t.join(timeout=5)\n```\n\n## 7. Python: v4.0.0 runtime modules (opt-in)\n\n### `db` — SQLAlchemy session + health (needs `[db]`)\n```python\nfrom vibey_bootstrap.db import get_db, get_sessionmaker, db_health, postgres_rls_statements\nfrom vibey_bootstrap.db.migrations import upgrade_to_head, write_env_py\nfrom vibey_bootstrap.db.outbox import Outbox, drain_outbox, OUTBOX_DDL\n\n# FastAPI dependency — yields and always closes:\n# def endpoint(db: Session = Depends(get_db)): ...\n\nhealth = db_health()   # {\"status\": \"ok\"|\"error\", \"latency_ms\": ...}\n```\nEnv: `DATABASE_URL` (required). `create_engine_from_env()` sets `pool_pre_ping=True`.\n\n### `db.outbox` — transactional outbox (needs `[db]`)\n```python\noutbox = Outbox(session)\nmsg = outbox.enqueue(idempotency_key=\"email-123\", payload={\"to\": [...], \"subject\": \"...\"})\nsent = drain_outbox(session, AcsEmailSender(), batch_size=10)\n```\n`OUTBOX_DDL` is Postgres-oriented (`JSONB`, `FOR UPDATE SKIP LOCKED` in drain).\n`AcsEmailSender.__call__` is outbox-compatible.\n\n### `email` — ACS sender (needs `[email]`)\n```python\nfrom vibey_bootstrap.email import AcsEmailSender\nsender = AcsEmailSender()   # reads ACS_CONNECTION_STRING, ACS_SENDER_ADDRESS\nsender.send(to=[\"user@example.com\"], subject=\"...\", html_body=\"...\")\n```\n\n### `http` — hardened outbound client (needs `[http]` \u002F `[http-async]`)\n```python\nfrom vibey_bootstrap.http import build_session, request_with_retry, normalize_pem, write_temp_pem\nfrom vibey_bootstrap.http.async_client import build_async_client, async_request_with_retry\n\nresp = request_with_retry(\"GET\", \"https:\u002F\u002Fapi.example.com\u002Fdata\", allow_private=False)\n```\nSSRF guard (`check_ssrf`), default timeout, `traceparent` injection, urllib3 Retry on\n`408\u002F429\u002F5xx` with `Retry-After`. PEM helpers normalize Key-Vault-mangled certs.\n\n### `documentdb` — Mongo\u002FCosmos (needs `[documentdb]`)\n```python\nfrom vibey_bootstrap.documentdb import mongo_client_from_env, documentdb_health\nclient = mongo_client_from_env()   # NOSQL_URI\n```\nEnv: `NOSQL_URI`, `NOSQL_DATABASE`.\n\n### `aks` — pod runtime helpers (stdlib, `[aks]` marker)\n```python\nfrom vibey_bootstrap.aks import (\n    install_sigterm_handler, setup_async_sigterm_handler,\n    build_info, keda_metric_value, mount_build_info_route, pod_context_extra,\n)\nfrom vibey_bootstrap.aks.leader_election import leader_election, LeaderElection\n\ninstall_sigterm_handler(stop_event)\ninfo = build_info()   # BUILD_VERSION, GIT_SHA, POD_NAME, POD_NAMESPACE, …\nelection = leader_election()   # soft no-op when LEADER_ELECTION_CONFIGMAP unset\nif election.is_leader():\n    run_scheduled_job()\n```\nEnv: `BUILD_VERSION` \u002F `APP_VERSION`, `GIT_SHA`, `POD_NAME`, `POD_NAMESPACE`,\n`NODE_NAME`, `LEADER_ELECTION_CONFIGMAP`.\n\n### `governance` — budget guard + usage meter (stdlib, `[governance]` marker)\n```python\nfrom vibey_bootstrap.governance import budget_guard, track_usage, BudgetGuard, UsageTracker\n\ncheck = budget_guard(\"my-project\", \"daily\", estimated_usd=0.05)\nif not check.allowed:\n    raise RateLimitError(\"budget exceeded\")\ntrack_usage(\"openai\", units=1200, unit_type=\"tokens\")\n```\n\n### `contrib.scaffold` — `vibey-bootstrap` CLI (core install)\n```bash\nvibey-bootstrap list\nvibey-bootstrap scaffold helm\u002Fworker\u002FChart.yaml.template --out .\u002Fdeploy --var APP_NAME=my-svc\nvibey-bootstrap version\n```\nTemplates: Terraform (AKS), Bicep, Helm worker chart, GitOps kustomize base, CI\u002FCD\nworkflows, OPA\u002FConftest policy starters. See `examples\u002F46_scaffold_cli.py`.\n\n### v3 extensions to Tier 1 modules (in existing subpackages)\n\n**`identity`** (v3): `build_tenant_credential()`, `build_tenant_credential_cached()`,\n`credential_health()`, `TokenCache`.\n\n**`audit`** (v3): `ChainedAuditRecord`, `AuditChain`, `verify_chain()` — tamper-evident\nhash-chained audit log entries atop `build_audit_extra`.\n","> **vibey-bootstrap** is the library formerly published as `azure-bootstrap` (renamed in 4.0.0: package `vibey-bootstrap`, import `vibey_bootstrap`, CLI `vibey-bootstrap`; `azbootstrap` remains as a deprecated alias). Feature-tier labels below (v2 primitives, v3 modules) are historical and unchanged.\n\n# Azure Bootstrap — Tier 2 \u002F Tier 3 Subpackages, v3 Runtime & Recipes\n\n## 5. Python: v2 Tier 2 \u002F Tier 3 subpackages (opt-in)\n\nConcise reference; each is an independent import path. See `examples\u002F` for runnable\ndemos (the numbers below reference numbered example files).\n\n### `alerts` — tiered dispatcher\n```python\nfrom vibey_bootstrap.alerts import (\n    register_dispatcher, alert_dev_team, AlertSeverity, install_global_exception_hooks,\n)\nregister_dispatcher(my_email_sender, recipients=[\"dev-alerts@example.com\"])\ninstall_global_exception_hooks()    # uncaught sync\u002Fasync exceptions auto-alert\nalert_dev_team(AlertSeverity.ERROR, subject=\"x failed\", context={...}, dedup_key=\"x\")\n```\n`register_dispatcher(sender, recipients=None)` wires a sender\n(`(recipients, subject, html_body) -> None`); `alert_dev_team(severity, subject,\ncontext=None, dedup_key=None)` fires one. `AlertSeverity` = `WARN | ERROR | CRITICAL`:\n**WARN is log-only**, **ERROR** is logged + queued to the digest and may escalate to\nCRITICAL, **CRITICAL** sends an email immediately (subject to the kill switch +\nrate-limit). `@traced(alert_on_error=...)` and most subpackages emit through this.\nTunables (env): `DEV_ALERTS_ENABLED` (kill switch, default on), `DEV_ALERT_RECIPIENTS`,\n`ALERT_DEDUP_WINDOW_SECONDS` (600), `ALERT_MAX_PER_HOUR` (30), `ALERT_ESCALATE_AFTER`\n(5), `ALERT_ESCALATE_WINDOW_SECONDS` (900), `ALERT_CRITICAL_SUBJECT_PREFIX`.\n\n### `fastapi_middleware` — request timing + 5xx alerts\n```python\nfrom vibey_bootstrap.fastapi_middleware import install_middleware\ninstall_middleware(app, probe_paths=(\"\u002Fhealth\u002Flive\",\"\u002Fhealth\u002Fready\"),\n                   alert_subject_prefix=\"[svc] \", fire_alerts=True)\n```\nProbe paths are **silent**. Non-probes log INFO (`\u003C400`) \u002F WARNING (`>=400`). A `5xx`\nfires an ERROR alert (`http_5xx:{path}:{status}`); an uncaught exception fires\n`http_crash:{path}:{type}` then re-raises. No headers added; correlation lives in\ncontext vars, not HTTP headers.\n\n### `health` — readiness probes\n```python\nfrom vibey_bootstrap.health import (\n    check_app_config_health, check_app_insights_health, check_app_insights_logging,\n)\n```\nEach returns `{\"status\": \"ok\" | \"not_configured\" | \"error\", ...}` (adds `\"mock\": True`\nunder `USE_MOCK_BOOTSTRAP`). `check_app_config_health` does a live App Config load;\nthe App Insights checks are fast readiness checks.\n\n### `auth` — webhook + API-key + HMAC (needs `fastapi` for route helper)\n```python\nfrom vibey_bootstrap.auth import (\n    install_graph_webhook_route, WebhookDedup, verify_api_key_header,\n    verify_webhook_client_state, validation_token_handshake,\n    verify_hmac_signature,   # v3 — GitHub\u002FSumo-style sha256=… bodies\n)\ninstall_graph_webhook_route(app, \"\u002Fapi\u002Fwebhooks\u002Femail\",\n    background_handler=on_message, rate_limit_bucket=webhook_bucket(),\n    dedup=WebhookDedup(ttl_seconds=600))\n```\nHTTP contract is documented in the `vibey-bootstrap-typescript` skill (Part 7).\n`verify_api_key_header(x_api_key, *, env_var=\"API_KEY\", fail_open_when_unset=True)` is\nan async FastAPI dependency raising `HTTPException(401)` on mismatch.\n`verify_hmac_signature(secret, raw_body, header_value)` is constant-time HMAC-SHA256\nfor generic webhook signature headers.\n\n### `ratelimit` — token bucket + multi-unit limiter\n```python\nfrom vibey_bootstrap.ratelimit import (\n    TokenBucket, MultiUnitLimiter, fastapi_rate_limit, webhook_bucket, admin_bucket,\n)\nbucket = TokenBucket(budget=240, refill_per_second=4.0, name=\"webhook\")\nlimiter = MultiUnitLimiter()   # v3 — per-tenant \u002F per-IP composite budgets\n@app.post(\"\u002Fx\", dependencies=[Depends(fastapi_rate_limit(bucket))])\nasync def x(): ...\n```\n```\n`consume(n=1.0) -> bool`; `snapshot()` for monitoring. Presets:\n`webhook_bucket()` = 240 burst \u002F 4 per s; `admin_bucket()` = 30 burst \u002F 0.5 per s.\n`fastapi_rate_limit` returns **429 with an empty body** (no budget leak).\n\n### `retry` — tenacity wrappers (needs `tenacity`)\n```python\nfrom vibey_bootstrap.retry import build_retry, retry_azure_transient, retry_ai_transient\n\n@retry_azure_transient(operation=\"blob.download\")   # 3 attempts, 2–10s, NetworkError|RateLimitError\ndef download(): ...\n\n@retry_ai_transient(operation=\"openai.chat\")        # 7 attempts, 2–120s, RateLimitError\ndef chat(): ...\n```\n\n### `ingress` — 4-gate attachment classifier\n```python\nfrom vibey_bootstrap.ingress import AttachmentClassifier, ClassifiedKind, enforce_zip_safety_limits\n\nresult = AttachmentClassifier().classify(           # gates: extension → MIME → size → magic-byte\n    filename=name, content_type=mime, size_bytes=len(data), content=data,\n)\nif result.allowed:\n    handle(result.kind)        # \"pdf\" | \"zip\"\n```\n`classify(...)` is **keyword-only** and returns\n`ClassificationResult(allowed, kind, reject_reason, extension_mismatch)`.\n`ClassifiedKind` is a **string literal** — `\"pdf\" | \"zip\" | \"reject\"` (the\nclassifier's `allowed_kinds` defaults to `(\"pdf\", \"zip\")`). Zip-bomb defense:\n`enforce_zip_safety_limits(data)` (defaults 500 MB uncompressed \u002F 1000 entries via\n`MAX_ZIP_UNCOMPRESSED_BYTES` and `MAX_ZIP_ENTRIES`).\n\n### `notify` — two-tier notifications\n```python\nfrom vibey_bootstrap.notify import (\n    build_failure_alert_body, build_unprocessable_notification,\n    build_validation_notice_body, should_notify_sender, UnprocessableReason,\n)\n# Builders are keyword-only:\nops_html = build_failure_alert_body(\n    attachment_name=name, correlation_id=cid, sender=addr,\n    error_summary=str(exc)[:500], audience=\"ops\",\n)\nif should_notify_sender(addr):    # per-sender throttle (max_per_hour=3, window_seconds=3600)\n    subject, html, text, reason = build_unprocessable_notification(\n        failure_reason=UnprocessableReason.VALIDATION_FAILURE,\n        sender=addr, attachment_summary=[], correlation_id=cid,\n    )\n```\nOps get full forensics (`build_failure_alert_body`); senders get a sanitized message\n(`build_unprocessable_notification`, which returns a `(subject, html, text, reason)`\ntuple). All builders take **keyword-only** args.\n\n### `heartbeat` — pulse + consumer watchdog\n```python\nfrom vibey_bootstrap.heartbeat import (\n    start_background_monitors, record_consumer_iteration, record_message_settled,\n)\nmonitors = start_background_monitors(stop_event)   # heartbeat + watchdog daemons\n```\nCall `record_consumer_iteration()` each loop; the watchdog fires an ERROR alert after\nsilence (default 30 min). Env: `HEARTBEAT_INTERVAL_SECONDS`,\n`WATCHDOG_INTERVAL_SECONDS`, `WATCHDOG_SB_SILENCE_SECONDS`.\n\n### `config_refresh` — dynamic log flags (run on a schedule)\n```python\nfrom vibey_bootstrap.config_refresh import refresh_log_flags\nrefresh_log_flags((\"DEBUG_LOGGING_ENABLED\", \"LOG_LEVEL\"))   # re-reads App Config; reapplies logging\n```\n\n### `subscription` — resource renewal loop\n```python\nfrom vibey_bootstrap.subscription import ensure_resource, renewal_loop, SubscriptionGone\n```\nIdempotent find-or-create + a SIGTERM-responsive renewal thread (sleeps in ≤5 s\nslices). Built for Graph webhook subscriptions but generic.\n\n### `servicebus` — consumer + DLQ + async extensions (needs `azure-servicebus`)\n```python\nfrom vibey_bootstrap.servicebus import handle_message, run_dlq_digest, issue_resubmit_token\nfrom vibey_bootstrap.servicebus.async_ext import (   # v3\n    run_async_consumer, ReplayGuard, service_bus_transport_type,\n)\nhandle_message(receiver, msg, processor, schema=schema,\n               correlation_field=\"correlation_id\", source=\"consumer\", counter_namespace=\"sb\")\n```\n`handle_message(receiver, msg, processor, *, schema=None, correlation_field=\"correlation_id\",\nextra_correlation_fields=(), source=\"consumer\", counter_namespace=\"sb\")` parses JSON →\nvalidates → opens `correlation_scope` → calls your processor → classifies failures via\n`is_unrecoverable` into **complete \u002F abandon \u002F dead-letter**, and returns\n`(processed: bool, failed: bool)`. `processor` is a `MessageProcessor` Protocol\n(`process(payload)` + `notify_failure(payload, error)`). The DLQ digest\n(`run_dlq_digest`) sends HMAC-signed resubmit tokens —\n`issue_resubmit_token(secret, *, ttl_seconds=86400)` \u002F\n`verify_resubmit_token(secret, token)`.\n\nv3 async helpers: `run_async_consumer(client, queue_name, handler, stop_event=…)` for\nasyncio receive loops; `ReplayGuard` for bounded idempotency; `service_bus_transport_type()`\nreads `SERVICE_BUS_TRANSPORT_TYPE` (`amqp` or `websocket`).\n\n### `sb_lock` — message-lock renewal (needs `azure-servicebus`)\n```python\nfrom vibey_bootstrap.sb_lock import lock_for_process, ManagedLock\nwith lock_for_process(receiver, msg, max_lock_renewal_seconds=3600):\n    ...   # broker won't redeliver mid-process\n```\n\n### `openai` — AI usage tracker\n```python\nfrom vibey_bootstrap.openai import record_usage, acquire, usage_snapshot, check_thresholds_and_alert\nrecord_usage(\"gpt-4o\", prompt_tokens=1200, completion_tokens=300)\n```\nSliding-window tokens + cost (built-in pricing for GPT-4o & Claude 3 families;\noverride via `register_pricing`). Soft TPM cap via `acquire`. Env:\n`AI_TPM_LIMIT[_\u003CDEPLOYMENT>]`, `AI_COST_ALERT_HOURLY_DOLLARS`,\n`AI_COST_ALERT_DAILY_DOLLARS`, `AI_HIGH_USAGE_TOKENS_HOURLY`.\n\n### `tokens` — HMAC-SHA256 action tokens\n```python\nfrom vibey_bootstrap.tokens import issue_action_token, verify_action_token, InvalidActionToken\ntok = issue_action_token(SECRET, action=\"dlq_resubmit\", ttl_seconds=86400, payload={\"id\": \"m1\"})\nbody = verify_action_token(SECRET, tok, expected_action=\"dlq_resubmit\")   # raises InvalidActionToken\n```\nToken = `base64url(json_payload).base64url(hmac_sha256)`; payload carries `exp` (unix\nseconds) + `act`. **This is the interop point for the TS port** (see the\n`vibey-bootstrap-typescript` skill, Part 8).\n\n### `scheduler` — NCRONTAB parser (needs `apscheduler`)\n```python\nfrom vibey_bootstrap.scheduler import parse_cron_trigger\ntrigger = parse_cron_trigger(\"0 *\u002F5 * * * *\")   # 5- or 6-field NCRONTAB → APScheduler CronTrigger\n```\n\n### `metrics` — aggregate snapshot\n```python\nfrom vibey_bootstrap.metrics import build_metrics_snapshot\nsnap = build_metrics_snapshot()\n# {\"latency\": {...}, \"alert_counters\": {...}, \"ai_usage\": {...},\n#  \"bootstrap_initialized\": bool, \"last_sb_settle_age_seconds\": float|None}\n```\nSoft-imports contributors — sections for absent modules are simply omitted.\n\n### `pdf_safety` — strip active content (needs `pypdf`)\n```python\nfrom vibey_bootstrap.pdf_safety import sanitize_pdf_for_passthrough\nreader = sanitize_pdf_for_passthrough(reader)   # removes OpenAction\u002FAA\u002FJavaScript\u002FURI; best-effort\n```\n\n## 6. Python: end-to-end recipes\n\nThese mirror the runnable skeletons in `examples\u002F` — the canonical, tested source. Each\nruns offline with `USE_MOCK_BOOTSTRAP=true ... --dry-run`. Start at `examples\u002FREADME.md`\nfor the full numbered reading order (`01_quickstart.py` … `46_scaffold_cli.py`; v3:\n`39_v3_transports.py`, `44_db_outbox_email.py`, `45_http_client.py`).\n\n### 6.1 Azure Function (`examples\u002Fe2e_azure_function.py`)\n\nLazy idempotent startup, per-request correlation, a fully traced handler, audit lines:\n\n```python\nimport logging, uuid\nfrom vibey_bootstrap.alerts import install_global_exception_hooks, register_dispatcher\nfrom vibey_bootstrap.audit import build_audit_extra\nfrom vibey_bootstrap.bootstrap import ensure_bootstrap\nfrom vibey_bootstrap.counters import bump_counter\nfrom vibey_bootstrap.logging import configure_logging, correlation_scope\nfrom vibey_bootstrap.tracing import traced\n\nlogger = logging.getLogger(__name__)\n_started = False\n\ndef _startup() -> None:\n    global _started\n    if _started:\n        return\n    configure_logging()\n    install_global_exception_hooks()\n    ensure_bootstrap()\n    register_dispatcher(my_email_sender, recipients=[\"dev-alerts@example.com\"])\n    _started = True\n\n@traced(operation=\"example.handle_request\", alert_on_error=\"error\")\ndef handle_request(payload: dict) -> dict:\n    bump_counter(\"example.requests.processed\")\n    return {\"ok\": True}\n\ndef http_handler(request_id: str | None, body: dict) -> dict:\n    _startup()\n    cid = request_id or uuid.uuid4().hex[:12]\n    with correlation_scope(cid, request_id=cid):\n        logger.info(\"REPORT_AUDIT\", extra=build_audit_extra(\"http_request\", method=\"POST\"))\n        return handle_request(body)\n\n# In function_app.py:\n# @app.route(route=\"hello\", auth_level=func.AuthLevel.FUNCTION)\n# def hello(req): return func.HttpResponse(json.dumps(http_handler(req.headers.get(\"X-Request-Id\"), req.get_json())))\n```\n> Note: stdlib `LogRecord` reserves the key `name` — use a different `extra` key\n> (e.g. `payload_name`) when forwarding caller values.\n\n### 6.2 FastAPI pipeline (`examples\u002Fe2e_fastapi_pipeline.py`)\n\nBootstrap + alerts + middleware + webhook + health + API-key admin + `\u002Fapi\u002Fmetrics`:\n\n```python\nfrom fastapi import Depends, FastAPI, Header\nfrom vibey_bootstrap.alerts import install_global_exception_hooks, register_dispatcher\nfrom vibey_bootstrap.auth import WebhookDedup, install_graph_webhook_route, verify_api_key_header\nfrom vibey_bootstrap.bootstrap import ensure_bootstrap\nfrom vibey_bootstrap.fastapi_middleware import install_middleware\nfrom vibey_bootstrap.health import check_app_config_health, check_app_insights_health\nfrom vibey_bootstrap.logging import configure_logging\nfrom vibey_bootstrap.metrics import build_metrics_snapshot\nfrom vibey_bootstrap.ratelimit import admin_bucket, fastapi_rate_limit, webhook_bucket\n\nconfigure_logging(); install_global_exception_hooks(); ensure_bootstrap()\nregister_dispatcher(my_email_sender, recipients=[\"dev-alerts@example.com\"])\n\napp = FastAPI()\ninstall_middleware(app, probe_paths=(\"\u002Fhealth\u002Flive\", \"\u002Fhealth\u002Fready\"))\n\ninstall_graph_webhook_route(app, \"\u002Fapi\u002Fwebhooks\u002Femail\",\n    background_handler=on_message,\n    rate_limit_bucket=webhook_bucket(name=\"email_webhook\"),\n    dedup=WebhookDedup(ttl_seconds=600))\n\n@app.get(\"\u002Fhealth\u002Fready\")\ndef ready() -> dict:\n    return {\"status\": \"ok\",\n            \"app_config\": check_app_config_health(),\n            \"app_insights\": check_app_insights_health()}\n\nadmin_bkt = admin_bucket(name=\"admin_actions\")\n@app.post(\"\u002Fapi\u002Fadmin\u002Freload\", dependencies=[Depends(fastapi_rate_limit(admin_bkt))])\nasync def admin_reload(x_api_key: str = Header(default=None)) -> dict:\n    await verify_api_key_header(x_api_key)\n    return {\"reloaded\": True}\n\n@app.get(\"\u002Fapi\u002Fmetrics\")\ndef metrics() -> dict:\n    return build_metrics_snapshot()\n```\n\n### 6.3 AKS Service Bus worker (`examples\u002Fe2e_aks_sb_worker.py`)\n\nConsumer loop, heartbeat + watchdog, lock-per-message, SIGTERM-clean shutdown. v3 adds\n`install_sigterm_handler`, `build_info`, `pod_context_extra`, and optional\n`leader_election` for singleton schedulers:\n\n```python\nimport threading\nfrom vibey_bootstrap.aks import build_info, install_sigterm_handler, pod_context_extra\nfrom vibey_bootstrap.bootstrap import ensure_bootstrap\nfrom vibey_bootstrap.heartbeat import record_consumer_iteration, start_background_monitors\nfrom vibey_bootstrap.identity import build_credential\nfrom vibey_bootstrap.logging import configure_logging\nfrom vibey_bootstrap.sb_lock import lock_for_process\nfrom vibey_bootstrap.servicebus import handle_message\nfrom vibey_bootstrap.validation import queue_message_schema\n\ndef main_loop(receiver, processor, stop_event):\n    schema = queue_message_schema(required_fields=(\"correlation_id\",),\n                                  path_field=\"blob_path\", path_required_prefix=\"reports\u002F\")\n    while not stop_event.is_set():\n        record_consumer_iteration()\n        msg = receiver.receive()\n        if msg is None:\n            if stop_event.wait(0.1): break\n            continue\n        with lock_for_process(receiver, msg, max_lock_renewal_seconds=3600):\n            handle_message(receiver, msg, processor, schema=schema,\n                           correlation_field=\"correlation_id\", source=\"consumer\", counter_namespace=\"sb\")\n\ndef main_pod():\n    configure_logging(); ensure_bootstrap()\n    logger.info(\"pod starting\", extra={**pod_context_extra(), **build_info()})\n    credential = build_credential()   # WorkloadIdentity in-cluster\n    stop_event = threading.Event()\n    install_sigterm_handler(stop_event)   # v3 — replaces manual signal.signal\n    monitors = start_background_monitors(stop_event)\n    try:\n        main_loop(real_receiver, real_processor, stop_event)\n    finally:\n        stop_event.set()\n        for t in monitors: t.join(timeout=5)\n```\n\n## 7. Python: v4.0.0 runtime modules (opt-in)\n\n### `db` — SQLAlchemy session + health (needs `[db]`)\n```python\nfrom vibey_bootstrap.db import get_db, get_sessionmaker, db_health, postgres_rls_statements\nfrom vibey_bootstrap.db.migrations import upgrade_to_head, write_env_py\nfrom vibey_bootstrap.db.outbox import Outbox, drain_outbox, OUTBOX_DDL\n\n# FastAPI dependency — yields and always closes:\n# def endpoint(db: Session = Depends(get_db)): ...\n\nhealth = db_health()   # {\"status\": \"ok\"|\"error\", \"latency_ms\": ...}\n```\nEnv: `DATABASE_URL` (required). `create_engine_from_env()` sets `pool_pre_ping=True`.\n\n### `db.outbox` — transactional outbox (needs `[db]`)\n```python\noutbox = Outbox(session)\nmsg = outbox.enqueue(idempotency_key=\"email-123\", payload={\"to\": [...], \"subject\": \"...\"})\nsent = drain_outbox(session, AcsEmailSender(), batch_size=10)\n```\n`OUTBOX_DDL` is Postgres-oriented (`JSONB`, `FOR UPDATE SKIP LOCKED` in drain).\n`AcsEmailSender.__call__` is outbox-compatible.\n\n### `email` — ACS sender (needs `[email]`)\n```python\nfrom vibey_bootstrap.email import AcsEmailSender\nsender = AcsEmailSender()   # reads ACS_CONNECTION_STRING, ACS_SENDER_ADDRESS\nsender.send(to=[\"user@example.com\"], subject=\"...\", html_body=\"...\")\n```\n\n### `http` — hardened outbound client (needs `[http]` \u002F `[http-async]`)\n```python\nfrom vibey_bootstrap.http import build_session, request_with_retry, normalize_pem, write_temp_pem\nfrom vibey_bootstrap.http.async_client import build_async_client, async_request_with_retry\n\nresp = request_with_retry(\"GET\", \"https:\u002F\u002Fapi.example.com\u002Fdata\", allow_private=False)\n```\nSSRF guard (`check_ssrf`), default timeout, `traceparent` injection, urllib3 Retry on\n`408\u002F429\u002F5xx` with `Retry-After`. PEM helpers normalize Key-Vault-mangled certs.\n\n### `documentdb` — Mongo\u002FCosmos (needs `[documentdb]`)\n```python\nfrom vibey_bootstrap.documentdb import mongo_client_from_env, documentdb_health\nclient = mongo_client_from_env()   # NOSQL_URI\n```\nEnv: `NOSQL_URI`, `NOSQL_DATABASE`.\n\n### `aks` — pod runtime helpers (stdlib, `[aks]` marker)\n```python\nfrom vibey_bootstrap.aks import (\n    install_sigterm_handler, setup_async_sigterm_handler,\n    build_info, keda_metric_value, mount_build_info_route, pod_context_extra,\n)\nfrom vibey_bootstrap.aks.leader_election import leader_election, LeaderElection\n\ninstall_sigterm_handler(stop_event)\ninfo = build_info()   # BUILD_VERSION, GIT_SHA, POD_NAME, POD_NAMESPACE, …\nelection = leader_election()   # soft no-op when LEADER_ELECTION_CONFIGMAP unset\nif election.is_leader():\n    run_scheduled_job()\n```\nEnv: `BUILD_VERSION` \u002F `APP_VERSION`, `GIT_SHA`, `POD_NAME`, `POD_NAMESPACE`,\n`NODE_NAME`, `LEADER_ELECTION_CONFIGMAP`.\n\n### `governance` — budget guard + usage meter (stdlib, `[governance]` marker)\n```python\nfrom vibey_bootstrap.governance import budget_guard, track_usage, BudgetGuard, UsageTracker\n\ncheck = budget_guard(\"my-project\", \"daily\", estimated_usd=0.05)\nif not check.allowed:\n    raise RateLimitError(\"budget exceeded\")\ntrack_usage(\"openai\", units=1200, unit_type=\"tokens\")\n```\n\n### `contrib.scaffold` — `vibey-bootstrap` CLI (core install)\n```bash\nvibey-bootstrap list\nvibey-bootstrap scaffold helm\u002Fworker\u002FChart.yaml.template --out .\u002Fdeploy --var APP_NAME=my-svc\nvibey-bootstrap version\n```\nTemplates: Terraform (AKS), Bicep, Helm worker chart, GitOps kustomize base, CI\u002FCD\nworkflows, OPA\u002FConftest policy starters. See `examples\u002F46_scaffold_cli.py`.\n\n### v3 extensions to Tier 1 modules (in existing subpackages)\n\n**`identity`** (v3): `build_tenant_credential()`, `build_tenant_credential_cached()`,\n`credential_health()`, `TokenCache`.\n\n**`audit`** (v3): `ChainedAuditRecord`, `AuditChain`, `verify_chain()` — tamper-evident\nhash-chained audit log entries atop `build_audit_extra`.\n",{"name":5,"description":7},"develop","ae32736a1aabddabca5d2c96d665aa0ebc7d8700","src\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fvibey-bootstrap\u002Fskills\u002Fvibey-bootstrap-subpackages",3,"https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey","https:\u002F\u002Fthe-vibey-project.github.io\u002Fvibey\u002F","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project","https:\u002F\u002Fvibewithadam.matthewsteinberger.com","freedom for software engineers","2026-11-15 05:47:42",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add the-vibey-project\u002Fvibey --skill vibey-bootstrap-subpackages",{"tool":40,"command":41},"bunx","bunx skills add the-vibey-project\u002Fvibey --skill vibey-bootstrap-subpackages",{"tool":43,"command":44},"pnpm","pnpm dlx skills add the-vibey-project\u002Fvibey --skill vibey-bootstrap-subpackages","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fvibey-bootstrap\u002Fskills\u002Fvibey-bootstrap-subpackages\u002FSKILL.md",true,[],[49,56,63,70,77,84],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":19},"01M7AT1FQJAE1FQYAMDTF490Y4","white-paper-writing","Use when writing white papers, technical reports, policy documents, thought leadership pieces, or any long-form authoritative document. Triggers on requests to write, structure, outline, or review white papers, technical reports, position papers, policy briefs, or evidence-driven arguments. Also use for B2B content marketing strategy, technical documentation requiring authority, academic-style reports, or any document that must educate while persuading. Use when someone asks \"how should I structure this\" for a long-form document.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Fwhite-paper-writing\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M7AT16BJRJJKK2MASXRZS76G","prose-technical-mechanics","Use when editing or writing prose at a technical\u002Fmechanical level: choosing between Anglo-Saxon and Latinate diction, placing information in topic vs stress positions, writing periodic vs cumulative sentences, handling sentence rhythm, punctuation as logic, transitions, paragraph structure, or phonesthetics. Use when someone wants to understand WHY prose works or doesn't, not just surface-level style advice. Triggers on word choice, sentence structure, emphasis, rhythm, diction, or any deep writing mechanics question.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Fprose-technical-mechanics\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7AT0W9HT0ZZ9Y287NW99MR3","prose-mechanics","Use when writing, editing, or analyzing prose style; when trying to avoid generic AI-sounding writing; when applying specific prose styles such as journalistic, academic, narrative, KJV biblical, Hemingway plain, Latinate\u002FJamesian, Orwellian, Augustan, Victorian, Early Modern (Bacon, Browne, Milton), or free indirect discourse; or when coaching someone on writing voice and mechanics. Triggers on any request to improve, analyze, or write in a specific prose style, to fix \"AI-sounding\" writing, to make prose more vivid or concrete, to vary sentence rhythm, or to understand how a particular writer achieves their effects.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Fprose-mechanics\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M7AT0KR635JX66X2X6F3E2CP","narrative-structure","Use when structuring stories, pitches, presentations, white papers, or any persuasive narrative; analyzing the hero's journey in fiction or non-fiction; applying StoryBrand for business communication; designing narrative arcs for thought leadership; or understanding Vogler, Snyder, Propp, or Campbell frameworks. Triggers on any narrative structure, storytelling, pitch structure, StoryBrand, hero's journey, three-act structure, Freytag, Save the Cat, narrative arc, or \"how should I structure this story\u002Fpitch\u002Fpresentation\" request.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Fnarrative-structure\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M7AT0AKGW09NKKZDYBT8VRDE","legal-brief-writing","Use when writing legal briefs, motions, or any court filing; when analyzing judicial cognition and persuasion; when applying elite brief-writing techniques from Roberts, Clement, Kagan, Garner; or when structuring legal arguments for maximum persuasion. Also use for autistic\u002Fneurodivergent advocates who need to understand how their natural communication style maps to elite legal advocacy. Triggers on any legal writing, brief drafting, motion preparation, or legal argument structuring request.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Flegal-brief-writing\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M7AT00VWPS4Q8B5VEMXX9NQT","journal-publishability-criteria","Use whenever a research paper, article or preprint is being written, revised, reviewed or published, and specifically before every publication of docs\u002Fpaper.md. Covers what legitimate journals actually gate on, in order of gating — the editor's desk screen (scope, novelty, package problems), what reviewers judge (methodological soundness, claims the evidence can carry, statistical and qualitative reporting), EQUATOR reporting guidelines, the ICMJE authorship criteria, COPE's view of text recycling, the near-universal generative-AI policy (no AI author, disclosure, author responsibility), TOP 2025 transparency standards, how to verify a journal is legitimate, submitting without an institution, and a pre-submission checklist. Triggers on requests to evaluate, review, prepare or submit a paper, to judge publishability, to write a declarations or data-availability section, to disclose AI use, or to check a journal.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Fjournal-publishability-criteria\u002FSKILL.md",[],[]]