Skip to content
Merged
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
2 changes: 1 addition & 1 deletion Skill/boxel-development.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
},
{
"inclusionMode": "full",
"contentSummary": "SEARCH/REPLACE essentials, tracking mode, creating/modifying files, best practices",
"contentSummary": "Pointer to the Source Code Editing skill (SEARCH/REPLACE format, edit-tracking convention)",
"alternateTitle": "File Editing"
},
{
Expand Down
2 changes: 1 addition & 1 deletion Skill/dev-file-editing.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"cardInfo": {
"notes": null,
"name": "File Editing",
"summary": "SEARCH/REPLACE patterns and tracking mode for code generation",
"summary": "Pointer to the Source Code Editing skill, which defines the SEARCH/REPLACE format and edit-tracking convention",
"cardThumbnailURL": null
},
"commands": []
Expand Down
89 changes: 7 additions & 82 deletions Skill/dev-file-editing.md
Original file line number Diff line number Diff line change
@@ -1,85 +1,10 @@
### SEARCH/REPLACE Essentials
# File Editing

**Every .gts file line 1:**
```gts
// ═══ [EDIT TRACKING: ON] Mark all changes with ⁿ ═══
```
The SEARCH/REPLACE block format and the `.gts` edit-tracking convention (line-1 banner, `// ⁿ` markers) are defined in the canonical [Source Code Editing](../skills/source-code-editing/SKILL.md) skill, not here. If that skill is not already active in this room, read it before editing or creating any file.

**Creating new file:**
```gts
http://realm/card.gts (new)
╔═══ SEARCH ════╗
╠═══════════════╣
// ═══ [EDIT TRACKING: ON] Mark all changes with ⁿ ═══
import { CardDef } from '...'; // ¹
export class MyCard extends CardDef { } // ²
╚═══ REPLACE ═══╝
```
╰ ¹⁻²
Key reminders:

**Modifying existing:**
```gts
https://realm/card.gts
╔═══ SEARCH ════╗
existing code with tracking markers
╠═══════════════╣
modified code with new markers // ⁵
╚═══ REPLACE ═══╝
```
⁰ ⁵

## File Editing System

### Tracking Mode

**MANDATORY for .gts Files:**
1. All `.gts` files require tracking mode indicator on line 1:
```gts
// ═══ [EDIT TRACKING: ON] Mark all changes with ⁿ ═══
```
2. Format: `// ⁿ description` using sequential superscripts: ¹, ², ³...
3. Both SEARCH and REPLACE blocks must contain tracking markers

### SEARCH/REPLACE Patterns

#### Creating New File
```gts
http://realm/recipe-card.gts (new)
╔═══ SEARCH ════╗
╠═══════════════╣
// ═══ [EDIT TRACKING: ON] Mark all changes with ⁿ ═══
import { CardDef } from 'https://cardstack.com/base/card-api'; // ¹
export class RecipeCard extends CardDef { // ²
static displayName = 'Recipe';
}
╚═══ REPLACE ═══╝
```
⁰ ¹⁻²

#### Modifying Existing File
```gts
https://example.com/recipe-card.gts
╔═══ SEARCH ════╗
export class RecipeCard extends CardDef {
static displayName = 'Recipe';
@field recipeName = contains(StringField);
╠═══════════════╣
export class RecipeCard extends CardDef {
static displayName = 'Recipe';
@field recipeName = contains(StringField);
@field servings = contains(NumberField); // ¹⁸ Added servings
╚═══ REPLACE ═══╝
```
⁰ ¹⁸

### File Type Rules

- **`.gts` files** → ALWAYS require tracking mode and markers
- **`.json` files** → Never use tracking comments

### Best Practices

- Keep search blocks small and precise
- Include tracking comments in SEARCH blocks for uniqueness
- Search text must match EXACTLY
- Use placeholder comments for easy insertion points
- ALWAYS use SEARCH/REPLACE for `.gts` files — never `write-text-file`.
- Every `.gts` file starts with the `// ═══ [EDIT TRACKING: ON] Mark all changes with ⁿ ═══` banner; mark changed lines with sequential `// ⁿ` superscript comments. `.json` files never get tracking comments.
- For new files, append `(new)` after the file URL line.
- SEARCH text must match the existing file exactly; keep blocks small.
4 changes: 2 additions & 2 deletions Skill/source-code-editing.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
},
"instructionsSource": {
"links": {
"self": "./source-code-editing.md"
"self": "../skills/source-code-editing/SKILL.md"
},
"data": {
"type": "file",
"id": "./source-code-editing.md"
"id": "../skills/source-code-editing/SKILL.md"
}
}
}
Expand Down
114 changes: 0 additions & 114 deletions Skill/source-code-editing.md

This file was deleted.

2 changes: 1 addition & 1 deletion skills/boxel/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Core syntax and patterns (load when topic comes up):
- `references/core-patterns.md` — Card definitions, computed title, field definitions, computed properties.
- `references/prefers-wide-format.md` — When `static prefersWideFormat = true` is required (app-card homes, sectioned-record nav, 3D layouts, routed pages, dashboards, slide decks). Default is `false`; the most-forgotten static property. **Decide at CardDef creation time, not after the layout looks cramped.**
- `references/template-syntax.md` — Field access, compound fields, `@fields` delegation, array handling, fallback values, and Glimmer syntax gotchas (the `{{#if (this.x)}}` parens trap, HTML-tag-shadowing block params).
- `references/file-editing.md` — Edit tracking mode, SEARCH/REPLACE essentials, creating vs modifying files.
- `references/file-editing.md` — Pointer to the `source-code-editing` skill, which defines the SEARCH/REPLACE format and edit-tracking convention.
- `references/data-management.md` — File organization, JSON instance format, field value patterns, relationships.
- `references/card-references.md` — `links.self` shapes: relative (`./Foo/bar` / `../Foo/bar`) vs absolute vs registered-prefix; FileDef-typed relationships need the file extension; `$REALM` and `@cardstack/...` rules; common silent-failure modes.
- `references/defensive-programming.md` — Optional chaining, default values, try/catch, array validation.
Expand Down
89 changes: 8 additions & 81 deletions skills/boxel/references/file-editing.md
Original file line number Diff line number Diff line change
@@ -1,85 +1,12 @@
### SEARCH/REPLACE Essentials
# File Editing

**Every .gts file line 1:**
```gts
// ═══ [EDIT TRACKING: ON] Mark all changes with ⁿ ═══
```
The SEARCH/REPLACE block format and the `.gts` edit-tracking convention (line-1 banner, `// ⁿ` markers) are defined in the canonical [`source-code-editing`](../../source-code-editing/SKILL.md) skill, not here.

**Creating new file:**
```gts
http://realm/card.gts (new)
╔═══ SEARCH ════╗
╠═══════════════╣
// ═══ [EDIT TRACKING: ON] Mark all changes with ⁿ ═══
import { CardDef } from '...'; // ¹
export class MyCard extends CardDef { } // ²
╚═══ REPLACE ═══╝
```
╰ ¹⁻²
- Trigger: any file edit or creation — imports, fields, templates, computed properties, new `.gts` files.

**Modifying existing:**
```gts
https://realm/card.gts
╔═══ SEARCH ════╗
existing code with tracking markers
╠═══════════════╣
modified code with new markers // ⁵
╚═══ REPLACE ═══╝
```
⁰ ⁵
Key reminders:

## File Editing System

### Tracking Mode

**MANDATORY for .gts Files:**
1. All `.gts` files require tracking mode indicator on line 1:
```gts
// ═══ [EDIT TRACKING: ON] Mark all changes with ⁿ ═══
```
2. Format: `// ⁿ description` using sequential superscripts: ¹, ², ³...
3. Both SEARCH and REPLACE blocks must contain tracking markers

### SEARCH/REPLACE Patterns

#### Creating New File
```gts
http://realm/recipe-card.gts (new)
╔═══ SEARCH ════╗
╠═══════════════╣
// ═══ [EDIT TRACKING: ON] Mark all changes with ⁿ ═══
import { CardDef } from 'https://cardstack.com/base/card-api'; // ¹
export class RecipeCard extends CardDef { // ²
static displayName = 'Recipe';
}
╚═══ REPLACE ═══╝
```
⁰ ¹⁻²

#### Modifying Existing File
```gts
https://example.com/recipe-card.gts
╔═══ SEARCH ════╗
export class RecipeCard extends CardDef {
static displayName = 'Recipe';
@field recipeName = contains(StringField);
╠═══════════════╣
export class RecipeCard extends CardDef {
static displayName = 'Recipe';
@field recipeName = contains(StringField);
@field servings = contains(NumberField); // ¹⁸ Added servings
╚═══ REPLACE ═══╝
```
⁰ ¹⁸

### File Type Rules

- **`.gts` files** → ALWAYS require tracking mode and markers
- **`.json` files** → Never use tracking comments

### Best Practices

- Keep search blocks small and precise
- Include tracking comments in SEARCH blocks for uniqueness
- Search text must match EXACTLY
- Use placeholder comments for easy insertion points
- ALWAYS use SEARCH/REPLACE for `.gts` files — never `write-text-file`.
- Every `.gts` file starts with the `// ═══ [EDIT TRACKING: ON] Mark all changes with ⁿ ═══` banner; mark changed lines with sequential `// ⁿ` superscript comments. `.json` files never get tracking comments.
- For new files, append `(new)` after the file URL line.
- SEARCH text must match the existing file exactly; keep blocks small.
Loading