generated from coulomb/repo-seed
Renames the package, distribution, CLI alias, Makefile targets, and working directory from issue-facade to issue-core, signalling its role as the authoritative task lifecycle manager for the Coulomb org (peer to activity-core, rules-core, project-core). Adds POST /issues/ ingestion endpoint for activity-core's IssueSink, under a new optional [api] extra. The endpoint is served by `issue serve`, authenticates via the ISSUE_CORE_API_KEY env var (Bearer or X-API-Key header), and routes the TaskSpec payload to the configured default backend with full traceability metadata embedded in sync_metadata. - T01: Python package issue_tracker -> issue_core, dir rename - T02: registered in state hub under custodian domain - T03: INTENT.md (what it is, what it isn't, how it fits) - T04: SCOPE.md (in/out-of-scope, integration boundaries) - T05: POST /issues/ via FastAPI + Uvicorn, 9 unit tests - T06: docs/nats-task-ingestion.md design stub Closes ISSC-WP-0001. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
"""
|
|
`issue serve` — launch the issue-core REST API.
|
|
|
|
Requires the [api] extra: `pip install issue-core[api]`.
|
|
"""
|
|
|
|
import click
|
|
|
|
|
|
@click.command("serve")
|
|
@click.option("--host", default="127.0.0.1", show_default=True, help="Bind address.")
|
|
@click.option("--port", default=8765, show_default=True, type=int, help="Bind port.")
|
|
@click.option("--reload", is_flag=True, default=False, help="Auto-reload on code change (dev only).")
|
|
@click.option("--log-level", default="info", show_default=True, help="Uvicorn log level.")
|
|
def serve_command(host: str, port: int, reload: bool, log_level: str) -> None:
|
|
"""Launch the issue-core REST API (POST /issues/ ingestion endpoint).
|
|
|
|
Requires ISSUE_CORE_API_KEY to be set in the environment.
|
|
"""
|
|
try:
|
|
import uvicorn # noqa: F401
|
|
except ImportError:
|
|
raise click.ClickException(
|
|
"The 'api' extra is not installed. Run: pip install 'issue-core[api]'"
|
|
)
|
|
|
|
from ..api.auth import AuthConfigError, get_configured_api_key
|
|
|
|
try:
|
|
get_configured_api_key()
|
|
except AuthConfigError as exc:
|
|
raise click.ClickException(str(exc))
|
|
|
|
import uvicorn
|
|
|
|
uvicorn.run(
|
|
"issue_core.api.app:create_app",
|
|
host=host,
|
|
port=port,
|
|
reload=reload,
|
|
log_level=log_level,
|
|
factory=True,
|
|
)
|