Publish¶
lcp.publish ¶
Publish LCP manifests to the registry via GitHub Pull Request.
PublishError ¶
PublishResult
dataclass
¶
publish_manifest ¶
publish_manifest(document: LCPDocument, token: str, registry_repo: str = _DEFAULT_REGISTRY_REPO) -> PublishResult
Publish an LCP manifest to the registry via GitHub Pull Request.
This function performs the full publish workflow:
- Authenticates with GitHub using the provided token
- Forks the registry repository (if not already forked)
- Creates a branch for the new manifest
- Uploads the manifest file to the correct registry path
- Opens a pull request with structured content and labels
Re-running for the same (package, version) is idempotent: the
branch is reset, the file is updated in place, and an already-open
pull request is reused instead of raising.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
document
|
LCPDocument
|
Validated LCP document to publish. |
required |
token
|
str
|
GitHub personal access token with |
required |
registry_repo
|
str
|
Registry repository in |
_DEFAULT_REGISTRY_REPO
|
Returns:
| Type | Description |
|---|---|
PublishResult
|
|
Raises:
| Type | Description |
|---|---|
PublishError
|
If any step of the publish workflow fails. |
ValueError
|
If the registry repo format is invalid. |
Source code in src/lcp/publish.py
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 | |