feat: publish the portal shell and add the create-portal scaffolding CLI - #753
feat: publish the portal shell and add the create-portal scaffolding CLI#753kaviththiranga wants to merge 3 commits into
Conversation
Signed-off-by: Kavith Lokuhewage <kaviththiranga@gmail.com>
Signed-off-by: Kavith Lokuhewage <kaviththiranga@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (5)
📝 WalkthroughWalkthroughThe portal app now exposes optional Portal Assistant integration slots, while the stock app registers the assistant as a frontend feature. A new ChangesPortal Assistant integration
Portal scaffolding and release
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
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
⛔ Files ignored due to path filters (1)
yarn.lockis 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.prettierignorepackages/app/package.jsonpackages/app/src/App.tsxpackages/app/src/assistant.test.tsxpackages/app/src/assistant.tsxpackages/backend/src/index.tspackages/create-portal/.eslintrc.jspackages/create-portal/README.mdpackages/create-portal/bin/create-portalpackages/create-portal/package.jsonpackages/create-portal/scripts/generate-template.jspackages/create-portal/src/createPortal.tspackages/create-portal/src/generateTemplate.test.tspackages/create-portal/src/index.tspackages/create-portal/src/lib/errors.tspackages/create-portal/src/lib/tasks.tspackages/create-portal/templates-src/.openchoreo-portal.json.hbspackages/create-portal/templates-src/README.md.hbspackages/create-portal/templates-src/packages/app/src/App.test.tsxpackages/create-portal/templates-src/packages/app/src/App.tsxpackages/create-portal/templates-src/plugins/README.mdpackages/portal-app/package.jsonpackages/portal-app/src/apis.test.tspackages/portal-app/src/apis.tspackages/portal-app/src/apis/customOverrides.test.tsxpackages/portal-app/src/apis/customOverrides.tsxpackages/portal-app/src/assistant/PortalAssistantIntegrationApi.test.tsxpackages/portal-app/src/assistant/PortalAssistantIntegrationApi.tspackages/portal-app/src/components/Root/Root.tsxpackages/portal-app/src/components/catalog/EntityPage.tsxpackages/portal-app/src/createPortalApp.test.tsxpackages/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
| 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 |
There was a problem hiding this comment.
🗄️ 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.
| "publishConfig": { | ||
| "access": "public", | ||
| "registry": "https://npm.pkg.github.com" | ||
| }, |
There was a problem hiding this comment.
🩺 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.mdRepository: 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'}")
PYRepository: 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.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Signed-off-by: Kavith Lokuhewage <kaviththiranga@gmail.com>
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
npxCLI for scaffolding customized OpenChoreo portals.