Skip to content

Add explicit hosted publication and draft/public status - #60

Merged
elemdos merged 1 commit into
masterfrom
feat/explicit-publication
Oct 10, 2026
Merged

elemdos merged 1 commit into
masterfrom
feat/explicit-publication

Conversation

@elemdos

@elemdos elemdos commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

A successful primo push currently updates the hosted draft while the public site can remain stale. Keep plain push draft-only, add primo publish and push --publish, and report draft/publication status explicitly.

  • Publish the current hosted draft with authenticated requests, including remote server/site targets without a local checkout.
  • Add hosted status and JSON phase results for agents. Complete selected imports before publication; preserve successful push baselines on publication failure, exit nonzero, and print a publication-only retry command.
  • Reconcile lost activation responses and report unresolved outcomes as unknown. Use the CMS revision-checked publication protocol to prevent activating a changed draft.

Validation: TypeScript build; all 151 CLI tests pass, including real-CMS draft-only, successful publication, failed compilation preserving the previous public build, and publication-only recovery.

Requires the companion CMS publication endpoints and migration: primocms/primo#1300. Agent reference update: primocms/mcp#26. Upgrade the CMS and CLI together, then pull to refresh baselines because compilation artifacts are excluded from the content fingerprint.

Summary by CodeRabbit

  • New Features
    • Added primo publish to publish hosted drafts without uploading local files, with options to select targets and receive JSON results.
    • primo push can now publish after successfully saving changes with --publish, or return machine-readable results with --json. Preview mode does not apply or publish changes.
    • primo status can report hosted draft and publication status.
  • Documentation
    • Clarified the difference between saving a draft, publishing it, and doing both, with updated command guidance.

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dc0f66fb-982e-4092-b03e-8a9447e7d4ac

📥 Commits

Reviewing files that changed from the base of the PR and between 34deb1d and f418c1f.


📒 Files selected for processing (14)
  • README.md
  • src/commands/deploy.ts
  • src/commands/login.ts
  • src/commands/preview.ts
  • src/commands/publish.ts
  • src/commands/push.ts
  • src/commands/status.ts
  • src/index.ts
  • src/utils/command-output.ts
  • src/utils/hosted-targets.ts
  • src/utils/publication.ts
  • tests/helpers/mock-server.mjs
  • tests/publication.test.mjs
  • tests/publish-cms.test.mjs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.



📝 Walkthrough

Walkthrough

Adds hosted draft publication as a standalone command and as an option after successful pushes. The CLI reports push and publication outcomes separately, supports hosted publication status, and documents target selection, result states, and retry behavior.

Changes

Hosted Draft Publication

Layer / File(s) Summary
Resolve hosted publication targets
src/utils/hosted-targets.ts
Adds hosted-target discovery from explicit options or local configuration. Resolves server, site, and authentication values, validates selections, and formats scoped retry commands.
Publish and reconcile hosted drafts
src/utils/publication.ts, src/commands/preview.ts
Adds authenticated publication status retrieval and a workflow that checks revisions, compiles the hosted site, and activates a publication attempt. Reconciles uncertain outcomes against status and reports publication results.
Integrate publication with push
src/commands/push.ts, src/utils/command-output.ts
Adds structured push and publication reports. Push can publish after successful imports, tracks per-target outcomes, and handles JSON output and workspace server fallback.
Expose publish and hosted status commands
src/commands/publish.ts, src/commands/status.ts, src/index.ts, src/commands/deploy.ts, src/commands/login.ts, README.md
Registers standalone publishing and hosted status options. Updates command guidance and documentation to distinguish saving hosted drafts from publishing them.
Validate publication flows
tests/helpers/mock-server.mjs, tests/publication.test.mjs, tests/publish-cms.test.mjs
Adds mock publication endpoints and tests for push sequencing, standalone publishing, status reporting, ambiguous outcomes, and rendered CMS output.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant CLI as primo publish or primo push --publish
  participant PublishCommand as publish_site
  participant TargetResolver as hosted_targets
  participant Workflow as publish_target
  participant CMS as CMS publication API
  CLI->>PublishCommand: pass hosted publication options
  PublishCommand->>TargetResolver: resolve targets
  TargetResolver-->>PublishCommand: return selected targets
  PublishCommand->>Workflow: publish each target
  Workflow->>CMS: check revision and start attempt
  Workflow->>CMS: activate compiled attempt
  CMS-->>Workflow: return publication receipt or status
  Workflow-->>PublishCommand: return publication result
Loading

Merge Risk: ⚪ Minimal · up to f418c

This change keeps plain push draft-only and adds explicit publication and hosted status reporting. The review found no outstanding concrete defects, so it appears ready to merge after normal checks and a coordinated CMS upgrade.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 26.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 30 functions across 13 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarizes the main changes: explicit hosted publication and draft/publication status reporting.

Full details: Docstring Coverage

Explanation

Docstring coverage is 26.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 30 functions across 13 files. (1 skipped: 1 unsupported.)



  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@elemdos
elemdos merged commit 887bdd1 into master Oct 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant