Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions packages/host/app/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,17 @@ export const catalogRealm = ENV.resolvedCatalogRealmURL
export const skillsRealm = new RealmPaths(new URL(ENV.resolvedSkillsRealmURL));

/**
* Safely constructs a URL to a skill card in the skills realm.
* Uses the URL constructor to handle path joining safely.
* Safely constructs a universal @cardstack/skills/ reference to a skill card.
*
* @param skillId - The ID of the skill (e.g., 'boxel-environment', 'catalog-listing')
* @returns The complete URL to the skill card
* @returns The universal skill card reference
*
* @example
* skillCardURL('catalog-listing') // 'http://localhost:4201/skills/Skill/catalog-listing'
* skillCardURL('catalog-listing') // '@cardstack/skills/Skill/catalog-listing'
*/
export function skillCardURL(skillId: string): string {
return skillsRealm.fileURL(`Skill/${skillId}`).href;
return `@cardstack/skills/Skill/${skillId}`;
}

export const devSkillId = skillsRealm.fileURL(devSkillLocalPath).href;
export const envSkillId = skillsRealm.fileURL(envSkillLocalPath).href;
export const devSkillId = `@cardstack/skills/${devSkillLocalPath}`;
export const envSkillId = `@cardstack/skills/${envSkillLocalPath}`;
8 changes: 8 additions & 0 deletions packages/host/app/services/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ export default class NetworkService extends Service {
(rest) => new URL(rest, catalogURL).href,
);
}
if (config.resolvedSkillsRealmURL) {
let skillsURL = withTrailingSlash(config.resolvedSkillsRealmURL);
registerCardReferencePrefix('@cardstack/skills/', skillsURL);
virtualNetwork.addImportMap(
'@cardstack/skills/',
(rest) => new URL(rest, skillsURL).href,
);
}
if (config.resolvedOpenRouterRealmURL) {
let openRouterURL = withTrailingSlash(config.resolvedOpenRouterRealmURL);
registerCardReferencePrefix('@cardstack/openrouter/', openRouterURL);
Expand Down
2 changes: 1 addition & 1 deletion packages/matrix/helpers/isolated-realm-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export async function startServer({
serverArgs = serverArgs.concat([
`--username='skills_realm'`,
`--path='${skillsRealmDir}'`,
`--fromUrl='http://localhost:4205/skills/'`,
`--fromUrl='@cardstack/skills/'`,
`--toUrl='http://localhost:4205/skills/'`,
]);
serverArgs = serverArgs.concat([
Expand Down
4 changes: 2 additions & 2 deletions packages/matrix/tests/skills.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ test.describe('Skills', () => {
).toContainClass('checked');
}

const environmentSkillCardId = `http://localhost:4205/skills/Skill/boxel-environment`;
const environmentSkillCardId = `@cardstack/skills/Skill/boxel-environment`;
const defaultSkillCardsForCodeMode = [
`http://localhost:4205/skills/Skill/boxel-development`,
`@cardstack/skills/Skill/boxel-development`,
environmentSkillCardId,
];
const skillCard1 = `${appURL}/skill-pirate-speak`;
Expand Down
2 changes: 1 addition & 1 deletion packages/realm-server/scripts/start-development.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ LOW_CREDIT_THRESHOLD="${LOW_CREDIT_THRESHOLD:-2000}" \
\
--path='../skills-realm/contents' \
--username='skills_realm' \
--fromUrl="${REALM_BASE_URL}/skills/" \
--fromUrl='@cardstack/skills/' \
--toUrl="${REALM_BASE_URL}/skills/" \
\
${START_SUBMISSION:+--path="${SUBMISSION_REALM_PATH}"} \
Expand Down
2 changes: 1 addition & 1 deletion packages/realm-server/scripts/start-production.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ NODE_NO_WARNINGS=1 \
\
--path='/persistent/skills' \
--username='skills_realm' \
--fromUrl='https://app.boxel.ai/skills/' \
--fromUrl='@cardstack/skills/' \
--toUrl='https://app.boxel.ai/skills/' \
\
--path='/persistent/boxel-homepage' \
Expand Down
2 changes: 1 addition & 1 deletion packages/realm-server/scripts/start-staging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ NODE_NO_WARNINGS=1 \
\
--path='/persistent/skills' \
--username='skills_realm' \
--fromUrl='https://realms-staging.stack.cards/skills/' \
--fromUrl='@cardstack/skills/' \
--toUrl='https://realms-staging.stack.cards/skills/' \
\
--path='/persistent/boxel-homepage' \
Expand Down
2 changes: 1 addition & 1 deletion packages/realm-server/scripts/start-worker-development.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ NODE_ENV=development \
${START_CATALOG:+--fromUrl='@cardstack/catalog/'} \
${START_CATALOG:+--toUrl="${CATALOG_REALM_URL}"} \
\
--fromUrl="${REALM_BASE_URL}/skills/" \
--fromUrl='@cardstack/skills/' \
--toUrl="${REALM_BASE_URL}/skills/" \
\
${START_CATALOG:+--fromUrl="${EXTERNAL_CATALOG_REALM_URL}"} \
Expand Down
2 changes: 1 addition & 1 deletion packages/realm-server/scripts/start-worker-production.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ NODE_NO_WARNINGS=1 \
--fromUrl='@cardstack/catalog/' \
--toUrl="${CATALOG_REALM_URL}" \
\
--fromUrl='https://app.boxel.ai/skills/' \
--fromUrl='@cardstack/skills/' \
--toUrl='https://app.boxel.ai/skills/' \
\
--fromUrl="${EXTERNAL_CATALOG_REALM_URL}" \
Expand Down
2 changes: 1 addition & 1 deletion packages/realm-server/scripts/start-worker-staging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ NODE_NO_WARNINGS=1 \
--fromUrl="${EXTERNAL_CATALOG_REALM_URL}" \
--toUrl="${EXTERNAL_CATALOG_REALM_URL}" \
\
--fromUrl='https://realms-staging.stack.cards/skills/' \
--fromUrl='@cardstack/skills/' \
--toUrl='https://realms-staging.stack.cards/skills/' \
\
--fromUrl='@cardstack/openrouter/' \
Expand Down
Loading