Hide Create Listing for index cards in inspector and playground menu#4386
Hide Create Listing for index cards in inspector and playground menu#4386
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 52994efb28
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
|
|
||
| private get isIndexJsonInstanceFile() { | ||
| return this.args.readyFile.url.endsWith('/index.json'); |
There was a problem hiding this comment.
Restrict index-card guard to actual realm index cards
The new guard uses readyFile.url.endsWith('/index.json'), which suppresses Create Listing for any folder-style instance file named index.json (for example .../ViewCardDemo/index.json), not just a realm’s index card. In code-mode inspector this removes a valid action for non-index cards that happen to use index.json filenames; the check should key off card identity (e.g. ${realmURL}index) rather than filename suffix.
Useful? React with 👍 / 👎.
Preview deployments |
…e index-card checks
There was a problem hiding this comment.
Pull request overview
This PR updates Host/operator-mode UI logic to hide the Create Listing action specifically for the realm root index card (card id ${realmURL}index), avoiding the previous overly-broad filename-based checks (e.g. index.json anywhere).
Changes:
- Added shared runtime-common helpers
isRealmIndexCardId()andisRealmIndexCard()and refactored call sites to use them. - Updated operator-mode detail panel, stack item, and operator-mode state logic to use the shared index-card identity checks.
- Added unit + acceptance coverage to ensure Create Listing is omitted for the realm index card in code-mode contexts.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/runtime-common/code-ref.ts | Introduces shared isRealmIndexCardId / isRealmIndexCard helpers. |
| packages/base/menu-items.ts | Uses shared helper to omit “Create Listing” in code-mode playground menu for realm index card. |
| packages/host/app/components/operator-mode/detail-panel.gts | Hides Create Listing action button in inspector for realm index card instances. |
| packages/host/app/components/operator-mode/stack-item.gts | Refactors index-card detection to use shared helper. |
| packages/host/app/services/operator-mode-state-service.ts | Refactors index-card detection to use shared helper when trimming stacks. |
| packages/host/tests/unit/card-def-menu-items-test.ts | Adds unit test asserting Create Listing is omitted for index card in code-mode playground menu. |
| packages/host/tests/acceptance/code-submode/inspector-test.ts | Adds acceptance test asserting Create Listing action is not shown for index.json card instance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (!cardId || !realm) { | ||
| return false; | ||
| } | ||
| let realmHref = typeof realm === 'string' ? realm : realm.href; | ||
| return cardId === `${realmHref}index`; |
| } from './constants'; | ||
| import { CardError } from './error'; | ||
| import { meta, relativeTo } from './constants'; |
linear: https://linear.app/cardstack/issue/CS-10584/shouldnt-create-listing-from-indexjson-when-inside-code-mode
Replaces filename-based guard in operator-mode detail panel with card-identity check (card.id === ${realmURL}index).
Introduces shared helpers in runtime-common:
Before:

After:
