Add Cloudflare type generation, schema updates, and continuity log
- Add Cloudflare type generation command to CLAUDE.md. - Update schema definitions: added updatedDate, tags, description, id fields. - Create dev/continuity.md with template and examples. - Provide examples for communication patterns and file update. Hubert The Eunuch
This commit is contained in:
parent
f67c8f7c6b
commit
f31a1ec708
@ -26,6 +26,9 @@ pnpm notepad # Quick note-taking utility
|
|||||||
pnpm run convert:avif:all # Convert all images
|
pnpm run convert:avif:all # Convert all images
|
||||||
pnpm run convert:avif:jpeg # Convert JPEG only
|
pnpm run convert:avif:jpeg # Convert JPEG only
|
||||||
pnpm run convert:avif:png # Convert PNG only
|
pnpm run convert:avif:png # Convert PNG only
|
||||||
|
|
||||||
|
# Cloudflare types generation
|
||||||
|
pnpm cf-typegen # Generate Cloudflare types for TypeScript
|
||||||
```
|
```
|
||||||
|
|
||||||
## High-Level Architecture
|
## High-Level Architecture
|
||||||
@ -36,13 +39,13 @@ This is an Astro-based portfolio and blog site deployed on Cloudflare Pages. The
|
|||||||
Content is managed via Astro's Content Collections API with schema validation defined in `src/content.config.ts`:
|
Content is managed via Astro's Content Collections API with schema validation defined in `src/content.config.ts`:
|
||||||
|
|
||||||
- **`blog/`** - Blog posts as MDX files
|
- **`blog/`** - Blog posts as MDX files
|
||||||
- Schema: title, description, pubDate, heroImage (optional), featured (boolean), category, tags
|
- Schema: title, description, pubDate, updatedDate (optional), heroImage (optional), featured (boolean), category, tags
|
||||||
- Posts are sorted by pubDate (newest first)
|
- Posts are sorted by pubDate (newest first)
|
||||||
|
|
||||||
- **`sections/`** - Homepage section content (hero, experience, skills, featured-project)
|
- **`sections/`** - Homepage section content (hero, experience, skills, featured-project)
|
||||||
- Each section has a custom schema for its specific data needs
|
- Each section has a custom schema for its specific data needs
|
||||||
- Experience entries include systemId, status, dates, company, role, achievements, links
|
- Experience entries include systemId, status, dates, company, role, tags, description, achievements, link
|
||||||
- Skills entries include domain, tools, proficiency
|
- Skills entries include id, domain, tools, proficiency
|
||||||
|
|
||||||
- **`pages/`** - Page-specific content (contact form configuration)
|
- **`pages/`** - Page-specific content (contact form configuration)
|
||||||
- Includes form labels, social links, subject options
|
- Includes form labels, social links, subject options
|
||||||
|
|||||||
115
dev/continuity.md
Normal file
115
dev/continuity.md
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
# Continuity Log
|
||||||
|
|
||||||
|
## Template for New Entries
|
||||||
|
```
|
||||||
|
## YYYY-MM-DD - <Milestone>
|
||||||
|
|
||||||
|
### Changes Made
|
||||||
|
- Created X, Y, Z files
|
||||||
|
- Implemented feature A using pattern B
|
||||||
|
|
||||||
|
### Decisions
|
||||||
|
- Chose X over Y because...
|
||||||
|
- Pattern for Z is...
|
||||||
|
|
||||||
|
### How to Test
|
||||||
|
1. Navigate to...
|
||||||
|
2. Click...
|
||||||
|
3. Verify...
|
||||||
|
|
||||||
|
### Next Steps
|
||||||
|
- [ ] Item 1
|
||||||
|
- [ ] Item 2
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example: postMessage Pattern (Reference)
|
||||||
|
|
||||||
|
**Parent sends to iframe:**
|
||||||
|
```typescript
|
||||||
|
// lib/communication/iframe-controller.ts
|
||||||
|
export function selectElement(iframe: HTMLIFrameElement, nodeId: string) {
|
||||||
|
iframe.contentWindow?.postMessage(
|
||||||
|
{ type: 'SELECT_ELEMENT', payload: { nodeId } },
|
||||||
|
'http://localhost:4321' // Always explicit origin
|
||||||
|
)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Iframe sends to parent:**
|
||||||
|
```typescript
|
||||||
|
// Injected script in iframe
|
||||||
|
window.parent.postMessage(
|
||||||
|
{ type: 'ELEMENT_SELECTED', payload: { nodeId, rect, astroSource } },
|
||||||
|
'http://localhost:3000'
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
**Parent receives:**
|
||||||
|
```typescript
|
||||||
|
// lib/communication/message-handler.ts
|
||||||
|
window.addEventListener('message', (event) => {
|
||||||
|
if (event.origin !== 'http://localhost:4321') return
|
||||||
|
|
||||||
|
switch (event.data.type) {
|
||||||
|
case 'ELEMENT_SELECTED':
|
||||||
|
handleElementSelected(event.data.payload)
|
||||||
|
break
|
||||||
|
// ... other handlers
|
||||||
|
}
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example: Zustand Store Pattern (Reference)
|
||||||
|
```typescript
|
||||||
|
// lib/store/editor-store.ts
|
||||||
|
import { create } from 'zustand'
|
||||||
|
|
||||||
|
interface EditorStore {
|
||||||
|
selectedElement: SelectedElement | null
|
||||||
|
setSelectedElement: (el: SelectedElement | null) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useEditorStore = create<EditorStore>((set) => ({
|
||||||
|
selectedElement: null,
|
||||||
|
setSelectedElement: (el) => set({ selectedElement: el }),
|
||||||
|
}))
|
||||||
|
```
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
```typescript
|
||||||
|
const selectedElement = useEditorStore((state) => state.selectedElement)
|
||||||
|
const setSelectedElement = useEditorStore((state) => state.setSelectedElement)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example: File Update Pattern (Reference)
|
||||||
|
```typescript
|
||||||
|
// lib/astro/class-updater.ts
|
||||||
|
import { parse, walk } from '@astrojs/compiler'
|
||||||
|
|
||||||
|
export async function updateClasses(
|
||||||
|
filePath: string,
|
||||||
|
line: number,
|
||||||
|
col: number,
|
||||||
|
newClasses: string
|
||||||
|
): Promise<string> {
|
||||||
|
const source = await fs.readFile(filePath, 'utf-8')
|
||||||
|
const ast = await parse(source)
|
||||||
|
|
||||||
|
// Walk AST to find element at line:col
|
||||||
|
let targetNode = null
|
||||||
|
walk(ast, (node) => {
|
||||||
|
if (node.position?.start.line === line &&
|
||||||
|
node.position?.start.column === col) {
|
||||||
|
targetNode = node
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// Update class attribute in source string
|
||||||
|
// ... implementation
|
||||||
|
|
||||||
|
return updatedSource
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user