Marketplace core-development
Work on the core package (types, validation, normalization, diff). Use when modifying DSL processing logic or data flow.
install
source · Clone the upstream repo
git clone https://github.com/aiskillstore/marketplace
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/aiskillstore/marketplace "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/7nohe/core-development" ~/.claude/skills/aiskillstore-marketplace-core-development && rm -rf "$T"
manifest:
skills/7nohe/core-development/SKILL.mdsource content
Core Package Development
The core package (
packages/core/) is dependency-free and handles all DSL processing.
Data Flow
DSL (YAML input) → validate() → normalize() → IR → diff() → Patch
Key Files
| File | Purpose | Exports |
|---|---|---|
| Type definitions | DSL*, IR*, Patch, WebSocket protocol |
| YAML validation | |
| DSL → IR conversion | |
| IR diff calculation | |
Type Hierarchy
DSL Types (user input) IR Types (normalized) ───────────────────── ──────────────────── DSLDocument IRDocument ├─ version: number ├─ version: number ├─ docId: string ├─ docId: string ├─ title?: string ├─ title: string ├─ nodes: DSLNode[] ├─ nodes: Record<string, IRNode> └─ edges?: DSLEdge[] └─ edges: Record<string, IREdge> DSLNode IRNode ├─ id: string ├─ id: string ├─ provider: string ├─ provider: string ├─ kind: string ├─ kind: string ├─ label?: string ├─ label: string (default: id) ├─ parent?: string ├─ parent: string | null └─ layout: DSLLayout └─ layout: { x, y, w, h } DSLEdge IREdge ├─ id: string ├─ id: string ├─ from: string ├─ from: string ├─ to: string ├─ to: string └─ label?: string └─ label: string (default: "")
Patch Operations
type PatchOp = | { op: "upsertNode"; node: IRNode } | { op: "removeNode"; id: string } | { op: "upsertEdge"; edge: IREdge } | { op: "removeEdge"; id: string }; interface Patch { baseRev: number; nextRev: number; ops: PatchOp[]; }
WebSocket Protocol Types
// Plugin → CLI interface HelloMessage { type: "hello"; docId: string; secret?: string; } interface RequestFullMessage { type: "requestFull"; docId: string; } // CLI → Plugin interface FullMessage { type: "full"; rev: number; ir: IRDocument; } interface PatchMessage { type: "patch"; baseRev: number; nextRev: number; ops: PatchOp[]; } interface ErrorMessage { type: "error"; message: string; }
Development Workflow
- Modify types → Update
types.ts - Update validation → Ensure
catches invalid inputvalidate.ts - Update normalization → Handle new fields/defaults in
normalize.ts - Update diff → Handle new patch scenarios in
diff.ts - Add tests → Co-located
files*.test.ts - Run tests →
bun test packages/core/
Testing
# All core tests bun test packages/core/ # Specific test file bun test packages/core/src/diff.test.ts bun test packages/core/src/validate.test.ts bun test packages/core/src/normalize.test.ts # Watch mode bun test --watch packages/core/
Common Patterns
Adding a new node property
- Add to
andDSLNode
inIRNodetypes.ts - Add validation in
validate.ts - Add default value handling in
normalize.ts - Update diff logic if property affects equality
- Add test cases for validation, normalization, and diff
Adding a new edge property
- Add to
andDSLEdge
inIREdgetypes.ts - Add validation in
validate.ts - Add default value handling in
normalize.ts - Update diff logic for edge equality check
- Add test cases