Skip to content

Update commands to replace url with identifier#4627

Open
backspace wants to merge 16 commits intomainfrom
@cardstack/base-commands-cs-10992
Open

Update commands to replace url with identifier#4627
backspace wants to merge 16 commits intomainfrom
@cardstack/base-commands-cs-10992

Conversation

@backspace
Copy link
Copy Markdown
Contributor

@backspace backspace commented May 1, 2026

This is a mechanical renaming within the commands package, with updates like this:

  • sourceFileUrlsourceFileIdentifier
  • GetCatalogRealmUrlsCommandGetCatalogRealmIdentifiersCommand

Since this changes import paths that the separate boxel-catalog and boxel-skills repositories use, this includes rewrite scripts. After this is merged and settled, we can merge these PRs and then return to remove these import transformations.

backspace and others added 5 commits May 1, 2026 14:52
Renames in packages/base/command.gts:

- GetRealmOfUrl{Input,Result} → GetRealmOfResourceIdentifier{Input,Result}
  Field rename: url → resourceIdentifier, realmUrl → realmIdentifier
- RealmUrlCard → RealmIdentifierCard, .realmUrl → .realmIdentifier
- InvalidateRealmUrlsInput → InvalidateRealmIdentifiersInput
  Field rename: urls → resourceIdentifiers
- CanReadRealmInput.realmUrl → realmIdentifier
- GetDefaultWritableRealmResult.realmUrl → realmIdentifier
- ValidateRealm{Input,Result}.realmUrl → realmIdentifier

Also renames the host command file get-realm-of-url.ts →
get-realm-of-resource-identifier.ts (and its class), and the matching
test file. Sweeps all consumers and integration tests.

The wire payload to the realm-server invalidation endpoint stays as
'urls' since that's the server's protocol. Other commands that still
use 'realmUrl' as a field name (ExecuteAtomicOperationsInput,
SendAiAssistantMessageInput, EvaluateModuleInput, InstantiateCardInput,
etc.) are out of scope for this commit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Continues the CS-10992 sweep started in the previous commit:

Field renames in packages/base/command.gts:
- CopySourceInput.{originSourceUrl, destinationSourceUrl} → {originSourceIdentifier, destinationSourceIdentifier}
- CopySourceResult.url → identifier
- CopyFileToRealmInput.sourceFileUrl → sourceFileIdentifier
- CopyFileToRealmResult.newFileUrl → newFileIdentifier
- FileUrlCard → FileIdentifierCard, .fileUrl → .fileIdentifier
- WriteBinaryFileResult.fileUrl → fileIdentifier
- ReadBinaryFileInput.url → fileIdentifier
- PatchCodeCommandResult.finalFileUrl → finalFileIdentifier
- PatchCodeInput.fileUrl → fileIdentifier
- SendAiAssistantMessageInput.{attachedFileURLs, realmUrl} → {attachedFileIdentifiers, realmIdentifier}
- EvaluateModuleInput.{moduleUrl, realmUrl} → {moduleIdentifier, realmIdentifier}
- InstantiateCardInput.{moduleUrl, realmUrl} → {moduleIdentifier, realmIdentifier}
- ExecuteAtomicOperationsInput.realmUrl → realmIdentifier
- SanitizeModuleListInput/Result.moduleUrls → moduleIdentifiers
- GetAvailableRealmUrlsResult → GetAvailableRealmIdentifiersResult, .urls → .realmIdentifiers
- GetCatalogRealmUrlsResult → GetCatalogRealmIdentifiersResult, .urls → .realmIdentifiers
- FetchCardJsonInput.url → cardIdentifier
- RealmMetaField.url → realmIdentifier (and the inline RealmMeta type in realm.gts)

Sweeps consumers across host commands, components, services, tests, and
catalog-realm/experiments-realm.

Out of scope: AuthedFetchInput.url and SendRequestViaProxyInput.url
(generic URLs, not realm resource identifiers); RealmInfoField.{backgroundURL, iconURL}
(actual image URLs); GenerateThumbnailInput.{sourceImageUrl, targetRealmUrl} and
GenerateThumbnailOutput.imageDefUrl (image-domain fields).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- GenerateThumbnailInput.targetRealmUrl → targetRealmIdentifier
- GenerateThumbnailOutput.imageDefUrl → imageDefIdentifier

The catalog-realm UploadImageCommand and GenerateImageCommand have
their own targetRealmUrl fields (they're separate command classes
defined in catalog-realm) — those stay untouched in this commit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ntifier

The catalog-realm-defined UploadImageCommand and GenerateImageCommand
had their own targetRealmUrl input fields. Rename to targetRealmIdentifier
for consistency with the rest of the command-API renames in this branch.

Sweeps callers in catalog-realm (image fields, time-machine, adventure,
product-rotater) and experiments-realm (image-upload-tester).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

Preview deployments

Host Test Results

    1 files  ±0      1 suites  ±0   2h 1m 13s ⏱️ -59s
2 573 tests ±0  2 558 ✅ + 7  15 💤 ±0  0 ❌ ±0 
2 592 runs  ±0  2 577 ✅ +14  15 💤 ±0  0 ❌  - 7 

Results for commit 481359c. ± Comparison against earlier commit 0ad64f5.

Realm Server Test Results

    1 files  ±  0      1 suites  ±0   16m 10s ⏱️ + 6m 56s
1 256 tests +218  1 256 ✅ +218  0 💤 ±0  0 ❌ ±0 
1 334 runs  +230  1 334 ✅ +230  0 💤 ±0  0 ❌ ±0 

Results for commit 481359c. ± Comparison against earlier commit 0ad64f5.

backspace and others added 7 commits May 4, 2026 11:31
The previous rename commits updated class definitions in
packages/base/command.gts but missed several callers — tsc can't
catch them because Partial<FieldsOf<...>> CardDef constructors and
matrix runCommand payloads are both untyped object literals, so
mismatched keys silently leave the new field empty.

Production fixes (constructor was passing the old key):

- write-text-file.ts:97 — fileUrl → fileIdentifier
- write-binary-file.ts:135 — fileUrl → fileIdentifier
- get-default-writable-realm.ts:25 — realmUrl → realmIdentifier
- get-all-realm-metas.ts:33 — url → realmIdentifier
- software-factory/src/eval-execution.ts:378 — moduleUrl/realmUrl →
  moduleIdentifier/realmIdentifier in EVALUATE_MODULE_COMMAND payload
- software-factory/src/instantiate-execution.ts:722-726 — same for
  INSTANTIATE_CARD_COMMAND payload

Test fixes (tests still passed old keys to InputType):

- evaluate-module-test.gts (host integration)
- instantiate-card-test.gts (host integration)
- evaluate-module-command.spec.ts (software-factory)

This unbreaks downstream cascades: switch-submode createFile tests
read writeResult.fileIdentifier (empty), realm field tests read
realm.realmIdentifier (empty), and all eval-validation /
instantiate-validation SF tests fail at the runCommand layer.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ored

Continues the CS-10992 sweep — the result class names and field names
were already renamed in prior commits, but the host command class
names, file names, and shimModule string identifiers still used
"-urls"/"Urls" suffixes.

- get-available-realm-urls.ts → get-available-realm-identifiers.ts
  (GetAvailableRealmUrlsCommand → GetAvailableRealmIdentifiersCommand)
- get-catalog-realm-urls.ts → get-catalog-realm-identifiers.ts
  (GetCatalogRealmUrlsCommand → GetCatalogRealmIdentifiersCommand)
- invalidate-realm-urls.ts → invalidate-realm-identifiers.ts
  (InvalidateRealmUrlsCommand → InvalidateRealmIdentifiersCommand)

Sweeps the matching test files, listing-create / validate-realm
consumers, the shimModule registrations in commands/index.ts, and the
qunit module names. The realm.invalidateUrls service method is left
alone — service internals weren't part of the prior rename pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CS-10992 renamed four host commands from URL-flavored to
identifier-flavored module paths. boxel-skills still references the
old paths, but coordinating both repos at once is awkward —
particularly for `invalidate-realm-urls`, which two skill cards
(`Skill/boxel-environment.json`, `Skill/env-indexing-operations.json`)
hard-code in their `codeRef.module` field.

Add `packages/skills-realm/scripts/rewrite-legacy-aliases.mjs` and
invoke it after `skills:setup` / `skills:update` so the cloned
`contents/` tree gets the renamed paths. Idempotent — re-runs are
no-ops once the strings are gone.

Tracked by CS-11046; remove this shim once boxel-skills lands the
identifier-flavored paths.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@backspace backspace changed the title Update commands to use RIs and RRIs Update commands to replace url with identifier May 6, 2026
@backspace backspace marked this pull request as ready for review May 6, 2026 14:42
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 787e7c6078

ℹ️ 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".

Comment thread packages/host/app/commands/read-file-for-ai-assistant.ts
Comment thread packages/host/app/commands/show-file.ts
backspace and others added 4 commits May 6, 2026 10:29
read-file-for-ai-assistant and show-file consume `input.fileIdentifier`
after the FileUrlCard → FileIdentifierCard rename, but their
requireInputFields still listed `fileUrl`. The required-fields list
drives the JSON schema callers see, so tool callers were sending
`fileUrl` and the runtime read of `fileIdentifier` came back undefined.
Update both to `fileIdentifier` (and the show-file description).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mirrors the boxel-skills shim pattern (CS-11046). boxel-catalog
references several host commands and base-realm Card fields that
CS-10992 renamed from URL-flavored to identifier-flavored — most
visibly RealmMetaField.url, which made the live "Build" button click
in the catalog-app browse tests pass an undefined realmUrl into
StubListingAdapter.build and throw "Realm URL required for build action".

Add packages/catalog/scripts/rewrite-legacy-aliases.mjs and invoke it
after catalog:setup / catalog:update so the cloned contents/ tree gets
the renamed surface. The script applies 17 pinned source-span edits
across 8 files (imports, class names, destructuring, .execute({...})
argument keys, RealmMetaField.url accesses), is idempotent, and fails
loudly if expected spans are missing.

Tracked by CS-11046; remove this shim once boxel-catalog lands the
identifier-flavored surface.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR performs a mechanical rename across Boxel’s command surface (and call sites) from URL-oriented field/class names to identifier-oriented ones, and adds temporary rewrite shims to keep external boxel-catalog / boxel-skills content working during the transition.

Changes:

  • Renames many command input/output fields (e.g., *Url*Identifier, *URLs*Identifiers) and command modules (e.g., get-available-realm-urlsget-available-realm-identifiers).
  • Updates host command implementations and integration tests to match the new command shapes and import paths.
  • Adds temporary “rewrite legacy aliases” scripts (catalog + skills) and wires them into setup/update/reset scripts.

Reviewed changes

Copilot reviewed 99 out of 99 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/software-factory/tests/evaluate-module-command.spec.ts Updates evaluate-module command invocation to use identifier-based inputs.
packages/software-factory/src/instantiate-execution.ts Switches instantiated command input keys to identifier-based naming.
packages/software-factory/src/eval-execution.ts Updates evaluate-module execution input keys to identifier-based naming.
packages/skills-realm/scripts/rewrite-legacy-aliases.mjs Adds a temporary JSON rewrite shim for legacy command module paths in skills contents.
packages/skills-realm/package.json Runs the skills rewrite shim during setup/update.
packages/host/tests/integration/commands/write-text-file-test.gts Adjusts expectations to fileIdentifier output.
packages/host/tests/integration/commands/write-binary-file-test.gts Adjusts expectations to fileIdentifier output.
packages/host/tests/integration/commands/validate-realm-test.gts Updates validate-realm command inputs/outputs to realm identifiers.
packages/host/tests/integration/commands/use-ai-assistant-test.gts Renames attached file input field to attachedFileIdentifiers.
packages/host/tests/integration/commands/switch-submode-test.gts Updates renamed variables/paths for new file identifier field.
packages/host/tests/integration/commands/sanitize-module-list-test.gts Updates input/output field names to module identifiers.
packages/host/tests/integration/commands/reindex-realm-test.gts Updates command input from realmUrl to realmIdentifier.
packages/host/tests/integration/commands/read-file-for-ai-assistant-test.gts Updates input to fileIdentifier.
packages/host/tests/integration/commands/patch-code-test.gts Updates patch-code input/output field names to identifier-based naming.
packages/host/tests/integration/commands/open-workspace-test.gts Updates command input to realmIdentifier.
packages/host/tests/integration/commands/invalidate-realm-urls-test.gts Removes legacy invalidate-realm-urls test file.
packages/host/tests/integration/commands/invalidate-realm-identifiers-test.gts Adds invalidate-realm-identifiers test coverage.
packages/host/tests/integration/commands/instantiate-card-test.gts Updates instantiate-card inputs to identifier-based naming.
packages/host/tests/integration/commands/get-realm-of-url-test.gts Removes legacy get-realm-of-url test file.
packages/host/tests/integration/commands/get-realm-of-resource-identifier-test.gts Adds get-realm-of-resource-identifier test coverage.
packages/host/tests/integration/commands/get-default-writable-realm-test.gts Updates result field to realmIdentifier.
packages/host/tests/integration/commands/get-catalog-realm-urls-test.gts Removes legacy get-catalog-realm-urls test file.
packages/host/tests/integration/commands/get-catalog-realm-identifiers-test.gts Adds get-catalog-realm-identifiers test coverage.
packages/host/tests/integration/commands/get-available-realm-urls-test.gts Removes legacy get-available-realm-urls test file.
packages/host/tests/integration/commands/get-available-realm-identifiers-test.gts Adds get-available-realm-identifiers test coverage.
packages/host/tests/integration/commands/full-reindex-realm-test.gts Updates command input to realmIdentifier.
packages/host/tests/integration/commands/fetch-card-json-test.gts Updates input from url to cardIdentifier.
packages/host/tests/integration/commands/execute-atomic-operations-test.gts Updates input from realmUrl to realmIdentifier.
packages/host/tests/integration/commands/evaluate-module-test.gts Updates module/realm input fields to identifier naming.
packages/host/tests/integration/commands/copy-source-test.gts Updates copy-source input field names to identifiers.
packages/host/tests/integration/commands/copy-file-to-realm-test.gts Updates copy-file-to-realm inputs/outputs to identifier naming.
packages/host/tests/integration/commands/check-correctness-test.gts Updates patch-code inputs to fileIdentifier.
packages/host/tests/integration/commands/cancel-indexing-job-test.gts Updates command input to realmIdentifier.
packages/host/tests/integration/commands/can-read-realm-test.gts Updates command input to realmIdentifier.
packages/host/app/services/command-service.ts Updates patch-code integration and tracks final file identifier.
packages/host/app/components/operator-mode/send-error-to-ai-assistant.gts Switches to attachedFileIdentifiers when sending AI messages.
packages/host/app/components/operator-mode/ask-ai-container.gts Updates AI message input fields and passes realmIdentifier.
packages/host/app/commands/write-text-file.ts Updates output card type and field name to fileIdentifier.
packages/host/app/commands/write-binary-file.ts Updates output field name to fileIdentifier.
packages/host/app/commands/validate-realm.ts Migrates validation logic to realmIdentifier and new get-available command.
packages/host/app/commands/sync-openrouter-models.ts Updates input type to RealmIdentifierCard and error message field name.
packages/host/app/commands/switch-submode.ts Uses fileIdentifier from write command result.
packages/host/app/commands/show-file.ts Migrates input card to FileIdentifierCard and updates description/logic.
packages/host/app/commands/send-ai-assistant-message.ts Renames attached files input and passes realm identifier into context.
packages/host/app/commands/screenshot-card.ts Uses fileIdentifier when producing screenshot output.
packages/host/app/commands/sanitize-module-list.ts Migrates module list handling to identifiers and new realm-of command.
packages/host/app/commands/reindex-realm.ts Migrates input type to RealmIdentifierCard.
packages/host/app/commands/read-file-for-ai-assistant.ts Migrates input type to FileIdentifierCard.
packages/host/app/commands/read-binary-file.ts Migrates input field from url to fileIdentifier.
packages/host/app/commands/populate-with-sample-data.ts Updates AI assistant inputs to identifier naming.
packages/host/app/commands/patch-code.ts Migrates patch-code input/output to identifier naming for file fields.
packages/host/app/commands/open-workspace.ts Migrates input type/required fields to realmIdentifier.
packages/host/app/commands/one-shot-llm-request.ts Migrates attached files list input to attachedFileIdentifiers.
packages/host/app/commands/listing-use.ts Updates listing flow to use validated realmIdentifier.
packages/host/app/commands/listing-update-specs.ts Updates sanitize deps call to moduleIdentifiers.
packages/host/app/commands/listing-remix.ts Updates listing remix flow to use validated realmIdentifier.
packages/host/app/commands/listing-install.ts Updates validate-realm, fetch-card-json, and atomic-ops inputs to identifiers.
packages/host/app/commands/listing-generate-example.ts Updates default writable realm result destructuring to realmIdentifier.
packages/host/app/commands/listing-create.ts Migrates catalog realm lookup/sanitize/realm-of usage to identifier naming.
packages/host/app/commands/invalidate-realm-identifiers.ts Renames invalidate command module and input fields.
packages/host/app/commands/instantiate-card.ts Migrates required input fields to identifier naming.
packages/host/app/commands/index.ts Updates shim module paths and command class registry to renamed commands.
packages/host/app/commands/get-realm-of-url.ts Removes legacy get-realm-of-url command module.
packages/host/app/commands/get-realm-of-resource-identifier.ts Adds renamed realm-of command module.
packages/host/app/commands/get-default-writable-realm.ts Returns realmIdentifier in result.
packages/host/app/commands/get-catalog-realm-identifiers.ts Renames get-catalog command and result shape to identifiers.
packages/host/app/commands/get-available-realm-identifiers.ts Renames get-available command and result shape to identifiers.
packages/host/app/commands/get-all-realm-metas.ts Renames RealmMetaField property to realmIdentifier.
packages/host/app/commands/generate-thumbnail.ts Migrates target realm input/output field names to identifier naming.
packages/host/app/commands/generate-theme-example.ts Migrates one-shot attached files input name.
packages/host/app/commands/generate-example-cards.ts Migrates AI assistant + one-shot attached files and realm field names.
packages/host/app/commands/full-reindex-realm.ts Migrates input type to RealmIdentifierCard.
packages/host/app/commands/fetch-card-json.ts Migrates input field from url to cardIdentifier.
packages/host/app/commands/execute-atomic-operations.ts Migrates input field from realmUrl to realmIdentifier.
packages/host/app/commands/evaluate-module.ts Migrates input fields to moduleIdentifier/realmIdentifier.
packages/host/app/commands/copy-source.ts Migrates copy-source input/output field names to identifiers.
packages/host/app/commands/copy-file-to-realm.ts Migrates copy-file-to-realm inputs/outputs to identifiers.
packages/host/app/commands/cancel-indexing-job.ts Migrates input type to RealmIdentifierCard.
packages/host/app/commands/can-read-realm.ts Migrates input field from realmUrl to realmIdentifier.
packages/host/app/commands/ask-ai.ts Updates AI assistant invocation to pass realmIdentifier.
packages/host/app/commands/ai-assistant.ts Migrates attached files and realm field naming to identifiers.
packages/experiments-realm/submission-card/submission-card-portal.gts Updates RealmMetaField usage from url to realmIdentifier.
packages/experiments-realm/image-upload-tester.gts Updates generate-thumbnail input to targetRealmIdentifier.
packages/catalog/scripts/rewrite-legacy-aliases.mjs Adds temporary rewrite shim for legacy imports/field names in catalog contents.
packages/catalog/package.json Runs catalog rewrite shim during setup/update/reset.
packages/catalog-realm/time-machine/image-generator.gts Updates generate-thumbnail input to targetRealmIdentifier.
packages/catalog-realm/product-rotater/product-rotater.gts Updates upload-image input to targetRealmIdentifier.
packages/catalog-realm/fields/multiple-image.gts Updates upload-image input to targetRealmIdentifier.
packages/catalog-realm/fields/image.gts Updates upload-image input to targetRealmIdentifier.
packages/catalog-realm/commands/upload-image.ts Renames input field to targetRealmIdentifier and updates error message.
packages/catalog-realm/commands/generate-image-command.gts Renames input field to targetRealmIdentifier and updates upload invocation.
packages/catalog-realm/commands/collect-submission-files.ts Updates read-binary-file input from url to fileIdentifier.
packages/catalog-realm/catalog-app/listing/listing.gts Updates RealmMetaField usage from url to realmIdentifier.
packages/catalog-realm/catalog-app/components/listing-fitted.gts Updates RealmMetaField usage from url to realmIdentifier.
packages/catalog-realm/adventure/adventure.gts Updates upload-image input to targetRealmIdentifier.
packages/base/system-card.gts Updates RealmMetaField usage from url to realmIdentifier.
packages/base/realm.gts Renames RealmMeta shape and associated selection logic to realmIdentifier.
packages/base/file-menu-items.ts Updates copy/show file command I/O fields to identifier naming.
packages/base/command.gts Renames many command card fields/types from URL naming to identifier naming.
Comments suppressed due to low confidence (2)

packages/host/app/commands/instantiate-card.ts:58

  • Input fields were renamed to moduleIdentifier/realmIdentifier, but the required-field errors still say moduleUrl is required / realmUrl is required. This can confuse callers and makes debugging harder; update the messages (and any related labels) to match the new input field names (or consistently use “identifier” terminology).
    packages/host/app/commands/evaluate-module.ts:43
  • EvaluateModuleInput now uses moduleIdentifier/realmIdentifier, but the missing-field error still throws moduleUrl is required (and the validation labels still refer to moduleUrl/realmUrl). Align the error message (and ideally the labels) with the renamed input fields to avoid confusing API consumers.
  ): Promise<BaseCommandModule.EvaluateModuleResult> {
    let moduleUrl = input.moduleIdentifier;
    let realmUrl = input.realmIdentifier;

    if (!moduleUrl) {
      throw new Error('moduleUrl is required');
    }

    if (realmUrl) {
      this.validateModuleUrl(moduleUrl, realmUrl);
    }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +34 to +38
const ROOT = new URL('../contents', import.meta.url).pathname;

if (!existsSync(ROOT)) {
console.log(`[rewrite-legacy-aliases] ${ROOT} not found, skipping.`);
process.exit(0);
Comment thread packages/base/command.gts
@@ -582,31 +582,31 @@ export class RealmInfoField extends FieldDef {
export class RealmMetaField extends FieldDef {
@field info = contains(RealmInfoField);
@field canWrite = contains(BooleanField);
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.

2 participants