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
28 changes: 14 additions & 14 deletions packages/ai-bot/tests/prompt-construction-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ Current date and time: 2025-06-11T11:43:00.533Z
},
{
codeRef: {
module: rri('https://cardstack.com/base/card-api'),
module: rri('@cardstack/base/card-api'),
name: 'CardDef',
},
fields: [],
Expand Down Expand Up @@ -292,7 +292,7 @@ File open in code editor: http://localhost:4201/experiments/author.gts
Inheritance chain:
1. Address from http://localhost:4201/experiments/author
Fields: street, city, state
2. CardDef from https://cardstack.com/base/card-api
2. CardDef from @cardstack/base/card-api
Selected text: lines 10-12 (1-based), columns 5-20 (1-based)
Note: Line numbers in selection refer to the original file. Attached file contents below show line numbers for reference.
Module inspector panel: preview
Expand Down Expand Up @@ -1945,7 +1945,7 @@ Attached Files (files with newer versions don't show their content):
text: JSON.stringify({
data: {
type: 'card',
id: 'https://cardstack.com/base/Skill/card-editing',
id: '@cardstack/base/Skill/card-editing',
attributes: {
instructions:
'- If the user wants the data they see edited, AND the patchCardInstance function is available, you MUST use the "patchCardInstance" function to make the change.\n- If the user wants the data they see edited, AND the patchCardInstance function is NOT available, you MUST ask the user to open the card and share it with you.\n- If you do not call patchCardInstance, the user will not see the change.\n- You can ONLY modify cards shared with you. If there is no patchCardInstance function or tool, then the user hasn\'t given you access.\n- NEVER tell the user to use patchCardInstance; you should always do it for them.\n- If the user wants to search for a card instance, AND the "searchCard" function is available, you MUST use the "searchCard" function to find the card instance.\nOnly recommend one searchCard function at a time.\nIf the user wants to edit a field of a card, you can optionally use "searchCard" to help find a card instance that is compatible with the field being edited before using "patchCardInstance" to make the change of the field.\n You MUST confirm with the user the correct choice of card instance that he intends to use based upon the results of the search.',
Expand Down Expand Up @@ -1991,7 +1991,7 @@ Attached Files (files with newer versions don't show their content):
assert.true(systemPromptText.includes(SKILL_INSTRUCTIONS_MESSAGE));
assert.true(
systemPromptText.includes(
'Skill (id: https://cardstack.com/base/Skill/card-editing, title: Card Editing):',
'Skill (id: @cardstack/base/Skill/card-editing, title: Card Editing):',
),
'includes skill title metadata when present',
);
Expand Down Expand Up @@ -2024,7 +2024,7 @@ Attached Files (files with newer versions don't show their content):
text: JSON.stringify({
data: {
type: 'card',
id: 'https://cardstack.com/base/Skill/card-editing',
id: '@cardstack/base/Skill/card-editing',
attributes: {
instructions:
'- If the user wants the data they see edited, AND the patchCardInstance function is available, you MUST use the "patchCardInstance" function to make the change.\n- If the user wants the data they see edited, AND the patchCardInstance function is NOT available, you MUST ask the user to open the card and share it with you.\n- If you do not call patchCardInstance, the user will not see the change.\n- You can ONLY modify cards shared with you. If there is no patchCardInstance function or tool, then the user hasn\'t given you access.\n- NEVER tell the user to use patchCardInstance; you should always do it for them.\n- If the user wants to search for a card instance, AND the "searchCard" function is available, you MUST use the "searchCard" function to find the card instance.\nOnly recommend one searchCard function at a time.\nIf the user wants to edit a field of a card, you can optionally use "searchCard" to help find a card instance that is compatible with the field being edited before using "patchCardInstance" to make the change of the field.\n You MUST confirm with the user the correct choice of card instance that he intends to use based upon the results of the search.',
Expand Down Expand Up @@ -2243,7 +2243,7 @@ Attached Files (files with newer versions don't show their content):
text: JSON.stringify({
data: {
type: 'card',
id: 'https://cardstack.com/base/Skill/card-editing',
id: '@cardstack/base/Skill/card-editing',
attributes: {
instructions:
'- If the user wants the data they see edited, AND the patchCardInstance function is available, you MUST use the "patchCardInstance" function to make the change.\n- If the user wants the data they see edited, AND the patchCardInstance function is NOT available, you MUST ask the user to open the card and share it with you.\n- If you do not call patchCardInstance, the user will not see the change.\n- You can ONLY modify cards shared with you. If there is no patchCardInstance function or tool, then the user hasn\'t given you access.\n- NEVER tell the user to use patchCardInstance; you should always do it for them.\n- If the user wants to search for a card instance, AND the "searchCard" function is available, you MUST use the "searchCard" function to find the card instance.\nOnly recommend one searchCard function at a time.\nIf the user wants to edit a field of a card, you can optionally use "searchCard" to help find a card instance that is compatible with the field being edited before using "patchCardInstance" to make the change of the field.\n You MUST confirm with the user the correct choice of card instance that he intends to use based upon the results of the search.',
Expand Down Expand Up @@ -2668,7 +2668,7 @@ Attached Files (files with newer versions don't show their content):
},
meta: {
adoptsFrom: {
module: 'https://cardstack.com/base/search-results',
module: '@cardstack/base/search-results',
name: 'SearchResults',
},
},
Expand Down Expand Up @@ -2708,7 +2708,7 @@ Attached Files (files with newer versions don't show their content):
);
assert.equal(result[5].role, 'tool');
assert.equal(result[5].tool_call_id, 'tool-call-id-1');
const expected = `Tool call executed, with result card: {"data":{"type":"card","attributes":{"title":"Search Results","description":"Here are the search results","results":[{"data":{"type":"card","id":"http://localhost:4201/drafts/Author/1","attributes":{"firstName":"Alice","lastName":"Enwunder","photo":null,"body":"Alice is a software engineer at Google.","description":null,"thumbnailURL":null},"meta":{"adoptsFrom":{"module":"../author","name":"Author"}}}}]},"meta":{"adoptsFrom":{"module":"https://cardstack.com/base/search-results","name":"SearchResults"}}}}.`;
const expected = `Tool call executed, with result card: {"data":{"type":"card","attributes":{"title":"Search Results","description":"Here are the search results","results":[{"data":{"type":"card","id":"http://localhost:4201/drafts/Author/1","attributes":{"firstName":"Alice","lastName":"Enwunder","photo":null,"body":"Alice is a software engineer at Google.","description":null,"thumbnailURL":null},"meta":{"adoptsFrom":{"module":"../author","name":"Author"}}}}]},"meta":{"adoptsFrom":{"module":"@cardstack/base/search-results","name":"SearchResults"}}}}.`;

assert.equal((result[5].content as string).trim(), expected.trim());
});
Expand Down Expand Up @@ -2849,7 +2849,7 @@ Attached Files (files with newer versions don't show their content):
text: JSON.stringify({
data: {
type: 'card',
id: 'https://cardstack.com/base/Skill/skill_card_v1',
id: '@cardstack/base/Skill/skill_card_v1',
attributes: {
instructions: 'Test skill instructions',
title: 'Test Skill',
Expand All @@ -2868,7 +2868,7 @@ Attached Files (files with newer versions don't show their content):
text: JSON.stringify({
data: {
type: 'card',
id: 'https://cardstack.com/base/Skill/skill_card_v2',
id: '@cardstack/base/Skill/skill_card_v2',
attributes: {
instructions: 'Test skill instructions with updated commands',
commands: [
Expand Down Expand Up @@ -3093,7 +3093,7 @@ Attached Files (files with newer versions don't show their content):
text: JSON.stringify({
data: {
type: 'card',
id: 'https://cardstack.com/base/Skill/card-editing',
id: '@cardstack/base/Skill/card-editing',
attributes: {
instructions:
'- If the user wants the data they see edited, AND the patchCardInstance function is available, you MUST use the "patchCardInstance" function to make the change.\n- If the user wants the data they see edited, AND the patchCardInstance function is NOT available, you MUST ask the user to open the card and share it with you.\n- If you do not call patchCardInstance, the user will not see the change.\n- You can ONLY modify cards shared with you. If there is no patchCardInstance function or tool, then the user hasn\'t given you access.\n- NEVER tell the user to use patchCardInstance; you should always do it for them.\n- If the user wants to search for a card instance, AND the "searchCard" function is available, you MUST use the "searchCard" function to find the card instance.\nOnly recommend one searchCard function at a time.\nIf the user wants to edit a field of a card, you can optionally use "searchCard" to help find a card instance that is compatible with the field being edited before using "patchCardInstance" to make the change of the field.\n You MUST confirm with the user the correct choice of card instance that he intends to use based upon the results of the search.',
Expand Down Expand Up @@ -3269,7 +3269,7 @@ Current date and time: 2025-06-11T11:43:00.533Z
text: JSON.stringify({
data: {
type: 'card',
id: 'https://cardstack.com/base/Skill/skill_card_v1',
id: '@cardstack/base/Skill/skill_card_v1',
attributes: {
instructions: 'Test skill instructions',
title: 'Test Skill',
Expand All @@ -3288,7 +3288,7 @@ Current date and time: 2025-06-11T11:43:00.533Z
text: JSON.stringify({
data: {
type: 'card',
id: 'https://cardstack.com/base/Skill/skill_card_v2',
id: '@cardstack/base/Skill/skill_card_v2',
attributes: {
instructions: 'Test skill instructions with updated commands',
commands: [
Expand Down Expand Up @@ -3439,7 +3439,7 @@ Current date and time: 2025-06-11T11:43:00.533Z
text: JSON.stringify({
data: {
type: 'card',
id: 'https://cardstack.com/base/Skill/skill_card_v1',
id: '@cardstack/base/Skill/skill_card_v1',
attributes: {
instructions: 'Test skill instructions',
title: 'Test Skill',
Expand Down
8 changes: 4 additions & 4 deletions packages/base/cards-grid.gts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import FileIcon from '@cardstack/boxel-icons/file';
import {
chooseCard,
specRef,
baseRealm,
baseRealmRRI,
baseFileRef,
isCardInstance,
SupportedMimeType,
Expand Down Expand Up @@ -361,12 +361,12 @@ class Isolated extends Component<typeof CardsGrid> {
};
}[];
let excludedCardTypeIds = [
`${baseRealm.url}card-api/CardDef`,
`${baseRealm.url}cards-grid/CardsGrid`,
`${baseRealmRRI}card-api/CardDef`,
`${baseRealmRRI}cards-grid/CardsGrid`,
];
// The "All Files" group already represents the bare FileDef root — listing
// it again as a leaf would just be a duplicate row.
let excludedFileTypeIds = [`${baseRealm.url}card-api/FileDef`];
let excludedFileTypeIds = [`${baseRealmRRI}card-api/FileDef`];

this.cardTypeFilters.splice(0, this.cardTypeFilters.length);
this.fileTypeFilters.splice(0, this.fileTypeFilters.length);
Expand Down
4 changes: 2 additions & 2 deletions packages/base/components/cards-grid-layout.gts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from '@cardstack/boxel-ui/icons';

import {
baseRealm,
baseRealmRRI,
type Format,
type Query,
type RealmResourceIdentifier,
Expand Down Expand Up @@ -51,7 +51,7 @@ export const SORT_OPTIONS: SortOption[] = [
sort: [
{
on: {
module: `${baseRealm.url}card-api` as RealmResourceIdentifier,
module: `${baseRealmRRI}card-api` as RealmResourceIdentifier,
name: 'CardDef',
},
by: 'cardTitle',
Expand Down
2 changes: 1 addition & 1 deletion packages/boxel-cli/src/commands/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { search } from './search.ts';
* `@cardstack/runtime-common/constants`.
*/
const SPEC_TYPE = {
module: 'https://cardstack.com/base/spec',
module: '@cardstack/base/spec',
name: 'Spec',
} as const;

Expand Down
4 changes: 2 additions & 2 deletions packages/boxel-cli/tests/integration/file-delete.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ beforeAll(async () => {
attributes: { title: 'Keep' },
meta: {
adoptsFrom: {
module: 'https://cardstack.com/base/card-api',
module: '@cardstack/base/card-api',
name: 'CardDef',
},
},
Expand All @@ -40,7 +40,7 @@ beforeAll(async () => {
attributes: { title: 'Delete' },
meta: {
adoptsFrom: {
module: 'https://cardstack.com/base/card-api',
module: '@cardstack/base/card-api',
name: 'CardDef',
},
},
Expand Down
12 changes: 6 additions & 6 deletions packages/boxel-cli/tests/integration/file-lint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('file lint (integration)', () => {
});

it('returns fixed output for source with formatting issues', async () => {
let source = `import{CardDef}from 'https://cardstack.com/base/card-api';
let source = `import{CardDef}from '@cardstack/base/card-api';
export class MyCard extends CardDef {
@field name = contains(StringField);
}
Expand All @@ -77,7 +77,7 @@ export class MyCard extends CardDef {
});

it('returns fixed output with proper single-quote formatting', async () => {
let source = `import { CardDef } from "https://cardstack.com/base/card-api";
let source = `import { CardDef } from "@cardstack/base/card-api";
export class MyCard extends CardDef {
@field name = contains(StringField);
}
Expand All @@ -88,11 +88,11 @@ export class MyCard extends CardDef {
expect(result.fixed).toBe(true);
expect(result.output).toBeDefined();
// Prettier should convert double quotes to single quotes
expect(result.output).toContain("'https://cardstack.com/base/card-api'");
expect(result.output).toContain("'@cardstack/base/card-api'");
});

it('reports lint messages for unfixable issues', async () => {
let source = `import { CardDef } from 'https://cardstack.com/base/card-api';
let source = `import { CardDef } from '@cardstack/base/card-api';
export class MyCard extends CardDef {
}
<template>
Expand All @@ -118,7 +118,7 @@ export class MyCard extends CardDef {

describe('--fix with --file (local file)', () => {
it('writes fixed output back to a local file', async () => {
let unfixedSource = `import{CardDef}from 'https://cardstack.com/base/card-api';
let unfixedSource = `import{CardDef}from '@cardstack/base/card-api';
export class MyCard extends CardDef {
@field name = contains(StringField);
}
Expand Down Expand Up @@ -162,7 +162,7 @@ export class MyCard extends CardDef {

describe('--fix without --file (realm file)', () => {
it('writes fixed output back to the realm via write()', async () => {
let unfixedSource = `import{CardDef}from 'https://cardstack.com/base/card-api';
let unfixedSource = `import{CardDef}from '@cardstack/base/card-api';
export class MyCard extends CardDef {
@field name = contains(StringField);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/boxel-cli/tests/integration/file-read.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const SOURCE_JSON = JSON.stringify(
attributes: { title: 'Test Card' },
meta: {
adoptsFrom: {
module: 'https://cardstack.com/base/card-api',
module: '@cardstack/base/card-api',
name: 'CardDef',
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/boxel-cli/tests/integration/file-touch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function makeCardJson(title: string): string {
attributes: { title },
meta: {
adoptsFrom: {
module: 'https://cardstack.com/base/card-api',
module: '@cardstack/base/card-api',
name: 'CardDef',
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/boxel-cli/tests/integration/file-write.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe('file write (integration)', () => {
attributes: { title: 'Written Card' },
meta: {
adoptsFrom: {
module: 'https://cardstack.com/base/card-api',
module: '@cardstack/base/card-api',
name: 'CardDef',
},
},
Expand Down
4 changes: 2 additions & 2 deletions packages/boxel-cli/tests/integration/search.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ beforeAll(async () => {
attributes: { cardInfo: { name: 'Shared Card' } },
meta: {
adoptsFrom: {
module: 'https://cardstack.com/base/card-api',
module: '@cardstack/base/card-api',
name: 'CardDef',
},
},
Expand All @@ -50,7 +50,7 @@ beforeAll(async () => {
attributes: { cardInfo: { name: 'Other Card' } },
meta: {
adoptsFrom: {
module: 'https://cardstack.com/base/card-api',
module: '@cardstack/base/card-api',
name: 'CardDef',
},
},
Expand Down
26 changes: 15 additions & 11 deletions packages/boxel-ui/addon/bin/generate-component-specs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ const ADDON_DIR = path.resolve(SCRIPT_DIR, '..');
const REPO_ROOT = path.resolve(ADDON_DIR, '..', '..', '..');

const COMPONENTS_DIR = path.join(ADDON_DIR, 'src', 'components');
const CATALOG_DIR = path.join(REPO_ROOT, 'packages', 'catalog', 'contents', 'Spec');
const CATALOG_DIR = path.join(
REPO_ROOT,
'packages',
'catalog',
'contents',
'Spec',
);
const BARREL_FILE = path.join(ADDON_DIR, 'src', 'components.ts');

const SPEC_MODULE = '@cardstack/boxel-ui/components';
Expand All @@ -37,7 +43,8 @@ const SPEC_FILE_PREFIX = 'boxel-ui-';
// that doesn't actually exist.
function buildBarrelExportMap() {
const source = fs.readFileSync(BARREL_FILE, 'utf8');
const re = /^import\s+([A-Za-z0-9_$]+)[^;]*\s+from\s+['"]\.\/components\/([a-z0-9-]+)\/index\.gts['"]/gm;
const re =
/^import\s+([A-Za-z0-9_$]+)[^;]*\s+from\s+['"]\.\/components\/([a-z0-9-]+)\/index\.gts['"]/gm;
const candidates = new Map();
let m;
while ((m = re.exec(source)) !== null) {
Expand Down Expand Up @@ -104,7 +111,9 @@ function extractPrimaryUsageBlock(source) {

function extractStringAttr(text, name) {
// @name='value' or @name="value"
const re = new RegExp(`@${name}=(?:'((?:[^'\\\\]|\\\\.)*)'|"((?:[^"\\\\]|\\\\.)*)")`);
const re = new RegExp(
`@${name}=(?:'((?:[^'\\\\]|\\\\.)*)'|"((?:[^"\\\\]|\\\\.)*)")`,
);
const m = text.match(re);
if (!m) return null;
return (m[1] ?? m[2]).replace(/\\'/g, "'").replace(/\\"/g, '"');
Expand Down Expand Up @@ -152,10 +161,7 @@ function extractOptions(text, source) {
// const (`const validBottomTreatments = [...]`) shapes when they're array
// literals — which is most of the enum cases in usage.gts files.
if (source) {
const re = new RegExp(
`(?:^|\\b)${ref}\\s*=\\s*\\[([^\\]]*)\\]`,
'm',
);
const re = new RegExp(`(?:^|\\b)${ref}\\s*=\\s*\\[([^\\]]*)\\]`, 'm');
const m = source.match(re);
if (m) {
const opts = [];
Expand Down Expand Up @@ -399,9 +405,7 @@ function buildReadme({
}
sections.push('## Import');
sections.push(
'```ts\n' +
`import { ${componentName} } from '${SPEC_MODULE}';\n` +
'```',
'```ts\n' + `import { ${componentName} } from '${SPEC_MODULE}';\n` + '```',
);
sections.push('## API');
sections.push(buildApiTable(args));
Expand Down Expand Up @@ -438,7 +442,7 @@ function buildSpecJson({ componentName, cardDescription, readMe }) {
},
meta: {
adoptsFrom: {
module: 'https://cardstack.com/base/spec',
module: '@cardstack/base/spec',
name: 'Spec',
},
},
Expand Down
Loading
Loading