Skip to content

feat: publish the portal shell and add the create-portal scaffolding CLI - #753

Open
kaviththiranga wants to merge 3 commits into
openchoreo:mainfrom
kaviththiranga:feat/portal-app-publishable
Open

feat: publish the portal shell and add the create-portal scaffolding CLI#753
kaviththiranga wants to merge 3 commits into
openchoreo:mainfrom
kaviththiranga:feat/portal-app-publishable

Conversation

@kaviththiranga

@kaviththiranga kaviththiranga commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Composability Phase 2 (openchoreo/openchoreo#4330, design discussion openchoreo/openchoreo#4275): makes the portal shell a published package and adds a CLI that scaffolds a standalone, user-owned portal repo on top of it. Two commits, reviewable independently.

Summary by CodeRabbit

  • New Features
    • Added an npx CLI for scaffolding customized OpenChoreo portals.
    • Generated portals include setup guidance, configurable branding, plugin support, Docker deployment, and upgrade instructions.
    • Made the portal application publishable and extensible through optional assistant integrations.
  • Documentation
    • Added CLI usage, configuration, development, deployment, and template upgrade guidance.
  • Tests
    • Added validation for generated portal contents, dependency setup, application rendering, and optional integrations.
  • Release Improvements
    • Added automated scaffold verification and portal template publishing during releases.

Signed-off-by: Kavith Lokuhewage <kaviththiranga@gmail.com>
Signed-off-by: Kavith Lokuhewage <kaviththiranga@gmail.com>
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f92927a8-376b-4699-b54c-70eaac5c072c

📥 Commits

Reviewing files that changed from the base of the PR and between 43378bf and df8c011.

📒 Files selected for processing (6)
  • .github/workflows/release.yml
  • packages/create-portal/README.md
  • packages/create-portal/src/index.ts
  • packages/create-portal/src/lib/tasks.ts
  • packages/create-portal/templates-src/README.md.hbs
  • packages/create-portal/templates-src/packages/app/src/App.test.tsx
🚧 Files skipped from review as they are similar to previous changes (5)
  • packages/create-portal/README.md
  • .github/workflows/release.yml
  • packages/create-portal/templates-src/README.md.hbs
  • packages/create-portal/templates-src/packages/app/src/App.test.tsx
  • packages/create-portal/src/index.ts

📝 Walkthrough

Walkthrough

The portal app now exposes optional Portal Assistant integration slots, while the stock app registers the assistant as a frontend feature. A new @openchoreo/create-portal CLI generates validated portal templates, scaffolds projects, and integrates with the release workflow.

Changes

Portal Assistant integration

Layer / File(s) Summary
Optional assistant contract and host wiring
packages/portal-app/..., packages/app/...
The portal app exposes optional assistant integration slots. The stock app provides the assistant feature and related implementations.
Portal behavior and validation
packages/portal-app/src/components/..., packages/portal-app/src/assistant/..., packages/portal-app/src/*.test.ts*
Portal components use optional wrappers, build notifiers, and investigation actions. Tests cover registered and unregistered integrations.

Portal scaffolding and release

Layer / File(s) Summary
Template generation and validation
packages/create-portal/scripts/..., packages/create-portal/templates-src/..., packages/backend/src/index.ts
The generator copies selected monorepo content, removes private assistant wiring, pins workspace versions, applies overrides, and validates the output.
CLI scaffolding workflow
packages/create-portal/src/..., packages/create-portal/bin/..., packages/create-portal/package.json
The CLI resolves portal options, renders templates, initializes Git, installs dependencies, and reports task status and errors.
Release verification and publication
.github/workflows/release.yml, .changeset/...
The release workflow verifies generated portals and optionally publishes tagged templates to the portal-template repository.

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

Sequence Diagram(s)

sequenceDiagram
  participant ReleaseWorkflow
  participant CreatePortalGenerator
  participant PortalTemplateRepository
  participant CreatePortalCLI
  participant GeneratedPortal
  ReleaseWorkflow->>CreatePortalGenerator: generate and validate template
  CreatePortalGenerator-->>ReleaseWorkflow: return generated template
  ReleaseWorkflow->>PortalTemplateRepository: publish release contents and tag
  CreatePortalCLI->>PortalTemplateRepository: load packaged template
  CreatePortalCLI->>GeneratedPortal: render and initialize scaffold
  GeneratedPortal-->>CreatePortalCLI: install dependencies and compile
Loading

Possibly related PRs

Suggested reviewers: stefinie123

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description states the main purpose but omits nearly all required template sections, including goals, approach, tests, security, documentation, and environment. Complete the required template sections and provide details for implementation, testing, security checks, documentation, migration, and affected user stories.
Docstring Coverage ⚠️ Warning Docstring coverage is 54.17% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the two primary changes: publishing the portal shell and adding the create-portal scaffolding CLI.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.changeset/create-portal-cli.md:
- Around line 5-10: Update the create-portal CLI release documentation and
publishing configuration so the documented npx `@openchoreo/create-portal` command
resolves from its actual registry: either publish `@openchoreo/create-portal` to
npm, or explicitly document the GitHub Packages registry and required
authentication setup wherever the command is shown.

In @.github/workflows/release.yml:
- Around line 121-131: Update the template publication flow around the commit
and tag commands to check whether the remote already contains ${RELEASE_TAG}
before creating a commit or tag. If the tag exists, skip publication or validate
that it references the expected generated template; otherwise retain the
existing stable main and prerelease next push behavior.

In `@packages/create-portal/package.json`:
- Around line 14-17: Align the package publish configuration and installation
documentation: in packages/create-portal/package.json, update publishConfig so
`@openchoreo/create-portal` is published to the registry used by plain npx; in
packages/create-portal/README.md, update the documented command if retaining
GitHub Packages, including its registry and authentication requirements.

In `@packages/create-portal/src/index.ts`:
- Around line 22-42: Update the Commander option declarations for --name,
--path, --registry, and --template-path to use required value syntax instead of
optional bracket syntax, while preserving their existing descriptions and the
DEFAULT_REGISTRY default.

In `@packages/create-portal/src/lib/tasks.ts`:
- Around line 150-156: Update checkPathExistsTask to inspect the destination
directory after ensuring it exists, and fail when it contains any entries while
allowing a newly created or existing empty directory. Preserve the existing
directory-creation error handling and use the task’s existing error-reporting
flow for the rejection.

In `@packages/create-portal/templates-src/packages/app/src/App.test.tsx`:
- Around line 6-20: Update the test environment setup in App.test.tsx to clone
the existing process.env before overriding NODE_ENV and APP_CONFIG, preserving
inherited variables such as PATH and registry settings for subsequent tests.

In `@packages/create-portal/templates-src/README.md.hbs`:
- Around line 15-17: Update the generated README template,
packages/create-portal/README.md, and the install error message to instruct
users to provide npmAuthToken via an environment variable or user-level Yarn
configuration, never by committing registry tokens to project files.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6c67bd5b-5795-4753-935b-c8fbb3a9d4e5

📥 Commits

Reviewing files that changed from the base of the PR and between 6c8c373 and 43378bf.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (37)
  • .changeset/config.json
  • .changeset/create-portal-cli.md
  • .changeset/portal-app-publishable.md
  • .github/workflows/release.yml
  • .gitignore
  • .prettierignore
  • packages/app/package.json
  • packages/app/src/App.tsx
  • packages/app/src/assistant.test.tsx
  • packages/app/src/assistant.tsx
  • packages/backend/src/index.ts
  • packages/create-portal/.eslintrc.js
  • packages/create-portal/README.md
  • packages/create-portal/bin/create-portal
  • packages/create-portal/package.json
  • packages/create-portal/scripts/generate-template.js
  • packages/create-portal/src/createPortal.ts
  • packages/create-portal/src/generateTemplate.test.ts
  • packages/create-portal/src/index.ts
  • packages/create-portal/src/lib/errors.ts
  • packages/create-portal/src/lib/tasks.ts
  • packages/create-portal/templates-src/.openchoreo-portal.json.hbs
  • packages/create-portal/templates-src/README.md.hbs
  • packages/create-portal/templates-src/packages/app/src/App.test.tsx
  • packages/create-portal/templates-src/packages/app/src/App.tsx
  • packages/create-portal/templates-src/plugins/README.md
  • packages/portal-app/package.json
  • packages/portal-app/src/apis.test.ts
  • packages/portal-app/src/apis.ts
  • packages/portal-app/src/apis/customOverrides.test.tsx
  • packages/portal-app/src/apis/customOverrides.tsx
  • packages/portal-app/src/assistant/PortalAssistantIntegrationApi.test.tsx
  • packages/portal-app/src/assistant/PortalAssistantIntegrationApi.ts
  • packages/portal-app/src/components/Root/Root.tsx
  • packages/portal-app/src/components/catalog/EntityPage.tsx
  • packages/portal-app/src/createPortalApp.test.tsx
  • packages/portal-app/src/index.ts
💤 Files with no reviewable changes (4)
  • packages/portal-app/src/apis/customOverrides.tsx
  • packages/portal-app/src/apis.ts
  • packages/portal-app/package.json
  • packages/portal-app/src/apis.test.ts

Comment on lines +5 to +10
New `npx @openchoreo/create-portal` CLI that scaffolds a custom OpenChoreo
Portal: a thin Backstage app on the published portal packages, pinned to one
release. The template is rendered from the live monorepo at pack time
(private assistant wiring stripped, `workspace:^` ranges pinned to the
lockstep release version), ships inside the CLI tarball, and is pushed to the
`openchoreo/portal-template` repo per release as the `git merge` upgrade

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Verify where the scoped package is configured to publish and resolve.
jq '{name, publishConfig, packageManager}' packages/create-portal/package.json
fd -HI '(^\.npmrc$|^\.yarnrc\.yml$)' . -x sh -c '
  echo "--- $1"
  rg -n "`@openchoreo`|npmRegistryServer|npmScopes|npmPublishRegistry" "$1" || true
' sh {}

Repository: openchoreo/backstage-plugins

Length of output: 410


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- package metadata'
jq '{name, version, publishConfig, bin}' packages/create-portal/package.json

printf '%s\n' '--- release references'
rg -n -C 3 'create-portal|npm\.pkg\.github\.com|npm publish|publishConfig' .github packages package.json 2>/dev/null || true

printf '%s\n' '--- registry configuration'
fd -HI '(^\.npmrc$|^\.yarnrc\.yml$)' . -x sh -c '
  echo "--- $1"
  cat -n "$1"
' sh {}

Repository: openchoreo/backstage-plugins

Length of output: 15681


Make the documented npx command resolvable.

@openchoreo/create-portal publishes to GitHub Packages, while the README documents the default npm registry. Publish the CLI to npm, or document the required GitHub Packages registry and authentication configuration.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.changeset/create-portal-cli.md around lines 5 - 10, Update the
create-portal CLI release documentation and publishing configuration so the
documented npx `@openchoreo/create-portal` command resolves from its actual
registry: either publish `@openchoreo/create-portal` to npm, or explicitly
document the GitHub Packages registry and required authentication setup wherever
the command is shown.

Comment thread .github/workflows/release.yml
Comment on lines +14 to +17
"publishConfig": {
"access": "public",
"registry": "https://npm.pkg.github.com"
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C3 \
  '`@openchoreo/create-portal`|npm\.pkg\.github\.com|npm publish|yarn npm publish|--registry' \
  .github/workflows/release.yml \
  packages/create-portal/package.json \
  packages/create-portal/README.md

Repository: openchoreo/backstage-plugins

Length of output: 5060


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- release workflow ---'
sed -n '1,115p' .github/workflows/release.yml

printf '%s\n' '--- package and repository publish configuration ---'
cat packages/create-portal/package.json
printf '%s\n' '--- root package.json ---'
cat package.json
printf '%s\n' '--- registry-related configuration ---'
rg -n -C3 \
  'npmRegistryServer|npmScopes|npm\.pkg\.github\.com|registry|npm publish|yarn workspaces foreach' \
  --glob '!**/node_modules/**' \
  --glob '!**/dist/**' \
  .

Repository: openchoreo/backstage-plugins

Length of output: 50387


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
import json
import re
from pathlib import Path

pkg_path = Path("packages/create-portal/package.json")
readme_path = Path("packages/create-portal/README.md")
workflow_path = Path(".github/workflows/release.yml")

pkg = json.loads(pkg_path.read_text())
readme = readme_path.read_text()
workflow = workflow_path.read_text()

publish_registry = pkg["publishConfig"]["registry"]
install_command = "npx `@openchoreo/create-portal`"
has_plain_npx = install_command in readme
publish_step = re.search(
    r"- name: Publish to GitHub Packages(?P<body>.*?)(?=\n      - name:|\Z)",
    workflow,
    re.S,
)
publish_body = publish_step.group("body") if publish_step else ""
uses_workspace_publish = "yarn workspaces foreach" in publish_body and "npm publish" in publish_body

print(f"package={pkg['name']}")
print(f"publish_registry={publish_registry}")
print(f"readme_has_plain_npx={has_plain_npx}")
print(f"workflow_publish_step_found={publish_step is not None}")
print(f"workflow_uses_workspace_publish={uses_workspace_publish}")
print(f"documented_install_uses_explicit_registry={'--registry' in install_command}")
print(f"registry_contract_mismatch={publish_registry != 'https://registry.npmjs.org'}")
PY

Repository: openchoreo/backstage-plugins

Length of output: 420


Align the publish registry with the documented install command.

The release workflow publishes @openchoreo/create-portal to GitHub Packages, while plain npx @openchoreo/create-portal`` resolves from npmjs by default. Publish the CLI to npmjs, or document the required GitHub Packages registry and authentication.

📍 Affects 2 files
  • packages/create-portal/package.json#L14-L17 (this comment)
  • packages/create-portal/README.md#L12-L14
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/create-portal/package.json` around lines 14 - 17, Align the package
publish configuration and installation documentation: in
packages/create-portal/package.json, update publishConfig so
`@openchoreo/create-portal` is published to the registry used by plain npx; in
packages/create-portal/README.md, update the documented command if retaining
GitHub Packages, including its registry and authentication requirements.

Comment thread packages/create-portal/src/index.ts
Comment thread packages/create-portal/src/lib/tasks.ts Outdated
Comment thread packages/create-portal/templates-src/packages/app/src/App.test.tsx
Comment thread packages/create-portal/templates-src/README.md.hbs Outdated
@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Signed-off-by: Kavith Lokuhewage <kaviththiranga@gmail.com>
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