Skip to content

WIP: Import cards #8459

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 50 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
9fff348
wip: integrate with import-tool
akhismat Apr 2, 2025
e082526
wip: build fine
akhismat Apr 2, 2025
34a6e19
update example-files
akhismat Apr 3, 2025
13bd1cb
Type and Cards imported (no child cards, nor references)
akhismat Apr 3, 2025
213a6f9
Fix description
akhismat Apr 3, 2025
a4712c7
Support parent-child for mastertags
akhismat Apr 3, 2025
b2c808b
grant child examples
akhismat Apr 3, 2025
7be55ef
working state after refactoring
akhismat Apr 3, 2025
287f2f2
minor cleanup
akhismat Apr 3, 2025
65d88cb
draft PR
akhismat Apr 3, 2025
088f9bb
recipes example
akhismat Apr 3, 2025
dfbca1d
temp instructions for card import structure
akhismat Apr 3, 2025
f8b8c75
initial tags support
akhismat Apr 4, 2025
a9063bd
wip: validation
akhismat Apr 4, 2025
bf8432f
wip: remove parent validation
akhismat Apr 4, 2025
c7297f2
wip: apply tags
akhismat Apr 4, 2025
f7a0663
wip
akhismat Apr 4, 2025
e7510ee
wip: mixins
akhismat Apr 6, 2025
3c68574
qfix build
akhismat Apr 6, 2025
3e9b4d2
tags applyed (no attributes)
akhismat Apr 6, 2025
1b82de3
disable invalid validations
akhismat Apr 6, 2025
c28cb89
ssuppot parent-child for cards
akhismat Apr 6, 2025
dbc864b
ssuppot parent-child for tags
akhismat Apr 6, 2025
de48eea
ssuppot system type cards import
akhismat Apr 6, 2025
aedc9ec
ssuppot system type cards import
akhismat Apr 6, 2025
f408e5a
renamings
akhismat Apr 7, 2025
7a3db5b
test examples
akhismat Apr 7, 2025
7cc3777
association supported for mastertags
akhismat Apr 7, 2025
52fb464
association supported bw tags
akhismat Apr 7, 2025
3fa4cdf
path resolver
akhismat Apr 7, 2025
7e00613
init support for relations
akhismat Apr 7, 2025
f090d35
init support for relations - two runs
akhismat Apr 7, 2025
cfcad5f
init support for relations recursivelly
akhismat Apr 7, 2025
6854595
Handle tags releations
akhismat Apr 7, 2025
025dde9
Handle tags releations
akhismat Apr 7, 2025
ee80ddb
working tags relations + examples
akhismat Apr 7, 2025
15f7287
fix tags attributes
akhismat Apr 8, 2025
33d061c
wip: support refto type
akhismat Apr 8, 2025
f36c01f
support refto attributes
akhismat Apr 8, 2025
e704d08
fix for tags refto attributes - not tested
akhismat Apr 8, 2025
4d5e77d
support importing new enums
akhismat Apr 8, 2025
46ec422
support enumof attributes
akhismat Apr 8, 2025
772b82c
support multy-select - multy-ref not tested
akhismat Apr 8, 2025
07b3a7d
support attachments
akhismat Apr 8, 2025
4558068
renamings
akhismat Apr 8, 2025
1e0e6bf
support blobs
akhismat Apr 8, 2025
0cb3f04
support blobs - uuids
akhismat Apr 8, 2025
0e9e9ae
logs and fixess
akhismat Apr 8, 2025
88e8ec6
fix examples
akhismat Apr 8, 2025
7d1cdd3
revert redundant changes
akhismat Apr 8, 2025
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
135 changes: 135 additions & 0 deletions dev/import-tool/docs/huly/CARDS_INSTRUCTIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Card Import Format Guide

## Directory Structure


All files are organized in the following structure:

```
workspace/
├── Recipes.yaml # Base type configuration
├── Recipes/ # Base type cards folder
│ ├── Classic Margherita Pizza.md
│ └── Chocolate Lava Cake.md
└── Recipes/Vegan/ # Child type folder
├── Vegan Recipe.yaml # Child type configuration
└── Mushroom Risotto.md # Child type card
```

## Types (Master Tags)

Types are described in YAML files and define the structure of cards.

### Base Type
Create file `Recipes.yaml`:

```
class: card:class:MasterTag
title: Recipe
properties:
- label: cookingTime # Property name
type: TypeString # Data type
- label: servings
type: TypeNumber
# ... other properties
```

### Child Type
Create file `Recipes/Vegan/Vegan Recipe.yaml`:

```
class: card:class:MasterTag
title: Vegan Recipe
properties:
- label: proteinSource
type: TypeString
# ... additional properties
```

## Cards

Cards are Markdown files with YAML header and content.

### Base Type Card
Create file `Recipes/Classic Margherita Pizza.md`:

```
title: Classic Margherita Pizza
cookingTime: 30 minutes
servings: 4
difficulty: Medium
category: Italian
calories: 850
chef: Mario Rossi
```

# Content in Markdown format
## Sections
- Lists
- Instructions
- Notes

### Child Type Card
Create file `Recipes/Vegan/Mushroom Risotto.md`:

```
title: Vegan Mushroom Risotto
cookingTime: 45 minutes
servings: 4
difficulty: Medium
category: Italian
calories: 380
chef: Maria Green
proteinSource: Mushrooms # Child type properties
isGlutenFree: true
allergens: None
```

# Content in Markdown format

## Important Rules

1. File Names:
- Type YAML files must end with `.yaml`
- Cards must have `.md` extension
- File names can contain spaces

2. Directory Structure:
- Child types must be in a subfolder named after the type
- Child type cards must be in the same folder as its configuration

3. Card YAML Header:
- Must start and end with `---`
- Must contain all properties defined in the type
- Values must match specified data types

4. Card Content:
- After YAML header goes regular Markdown text
- Can use all Markdown features (headings, lists, tables, etc.)

## Examples from Our System

1. Base Recipe Type:
- File: `Recipes.yaml`
- Defines basic recipe properties (cooking time, servings, difficulty, etc.)

2. Base Type Cards:
- `Recipes/Classic Margherita Pizza.md` - pizza recipe
- `Recipes/Chocolate Lava Cake.md` - dessert recipe

3. Vegan Recipe Child Type:
- File: `Recipes/Vegan/Vegan Recipe.yaml`
- Adds specific properties (protein source, gluten-free, allergens)

4. Child Type Card:
- `Recipes/Vegan/Mushroom Risotto.md` - vegan risotto
- Uses both base properties and vegan type properties

## Supported Data Types (to be extended)

- TypeString - text values
- TypeNumber - numeric values
- TypeBoolean - yes/no (true/false)
- TypeDate - dates
- TypeHyperlink - links
- TypeEnum - enumeration (list of possible values) (not supported yet)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class: core:class:Enum
title: AlphaBeta
values:
- Alpha
- Beta
9 changes: 9 additions & 0 deletions dev/import-tool/docs/huly/example-workspace/Difficulty.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class: core:class:Enum
title: Difficulty
values:
- Easy
- Medium
- Hard
- Expert
- Impossible

6 changes: 6 additions & 0 deletions dev/import-tool/docs/huly/example-workspace/DocumentCard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
class: card:types:Document
title: Document Example
---
CONTENT
bla bla bla
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class: core:class:Association
typeA: ./SlaveCard/FamiliarTag.yaml
typeB: ./SlaveCard/MinionTag.yaml
nameA: familiar
nameB: helpers
type: 1:N
10 changes: 10 additions & 0 deletions dev/import-tool/docs/huly/example-workspace/FileCard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
class: card:types:File
title: File Example
blobs:
- ./Recipes/files/cake.png
attachments:
- ./Recipes/files/cake.png
---

*DESCRiption*
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# RecipeRelations.yaml
class: core:class:Association
typeA: "./Recipes.yaml"
typeB: "./Recipes.yaml"
nameA: recommendedDesserts
nameB: recommendedMainDishes
type: "N:N" # 1:1, 1:N, N:N
19 changes: 19 additions & 0 deletions dev/import-tool/docs/huly/example-workspace/Recipes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class: card:class:MasterTag
title: Recipe
properties:
- label: cookingTime
type: TypeString
- label: servings
type: TypeNumber
- label: difficulty
enumOf: "./Difficulty.yaml"
# isArray: true # for multiple values
- label: category
type: TypeString
- label: calories
type: TypeNumber
- label: chef
type: TypeString
- label: relatedRecipes
refTo: "./Recipes.yaml"
isArray: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
title: Chocolate Lava Cake
cookingTime: 25 minutes
servings: 4
difficulty: Medium
category: Dessert
calories: 450
chef: Anna Smith
blobs:
- ./files/cake.png
recommendedMainDishes:
- ./Classic Margherita Pizza.md
- ./Vegan/Mushroom Risotto.md
---

# Chocolate Lava Cake

## Ingredients
- 200g dark chocolate (70% cocoa)
- 200g butter
- 4 eggs
- 200g sugar
- 120g flour
- 1 tsp vanilla extract
- Pinch of salt
- Butter for ramekins
- Cocoa powder for dusting

## Instructions
1. Melt chocolate and butter together
2. Whisk eggs and sugar until pale
3. Fold in chocolate mixture
4. Add flour and vanilla
5. Pour into buttered ramekins
6. Bake at 200°C (400°F) for 12 minutes

## Notes
- Serve immediately while warm
- Can be prepared ahead and refrigerated
- Perfect with vanilla ice cream
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: Rich Chocolate Sauce
tags:
- ../DietaryType.yaml
cookingTime: 10 minutes
servings: 4
difficulty: Easy
category: Dessert Components
calories: 200
chef: Maria Green
restrictions: Vegetarian
allergens: Dairy
relatedRecipes:
- '../Chocolate Lava Cake.md'
---

# Rich Chocolate Sauce for Lava Cake

## Ingredients
- 100g dark chocolate (70% cocoa)
- 100ml heavy cream
- 30g unsalted butter
- 1 tsp vanilla extract
- Pinch of sea salt

## Instructions
1. Chop chocolate into small pieces
2. Heat cream until just simmering
3. Pour hot cream over chocolate
4. Let stand for 1 minute
5. Stir until smooth
6. Add butter and vanilla
7. Mix until glossy

## Notes
- Use high-quality chocolate for best results
- Can be made ahead and reheated
- Store in refrigerator for up to 3 days
- Warm slightly before serving
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
title: Classic Margherita Pizza
tags:
- ./DietaryType.yaml
cookingTime: 30 minutes
servings: 4
difficulty: Medium
category: Italian
calories: 850
chef: Mario Rossi
restrictions: Vegetarian
allergens: Gluten, Dairy
recommendedDesserts:
- ./Chocolate Lava Cake.md

---

# Classic Margherita Pizza

## Ingredients
- 2 1/2 cups (300g) all-purpose flour
- 1 tsp salt
- 1 tsp active dry yeast
- 1 cup warm water
- 2 tbsp olive oil
- 1 cup tomato sauce
- 2 cups mozzarella cheese
- Fresh basil leaves
- Extra virgin olive oil

## Instructions
1. Mix flour, salt, and yeast in a large bowl
2. Add warm water and olive oil, knead for 10 minutes
3. Let rise for 1 hour
4. Roll out dough and add toppings
5. Bake at 450°F (230°C) for 15-20 minutes

## Notes
- For best results, use San Marzano tomatoes for the sauce
- Fresh mozzarella is preferred over pre-shredded
- Add basil leaves after baking

# Classic Margherita Pizza

## Ingredients
- Pizza dough
- San Marzano tomatoes
- Fresh mozzarella
- Fresh basil
- Extra virgin olive oil
- Salt

## Instructions
1. Preheat oven to 450°F (230°C)
2. Roll out the pizza dough
3. Add tomato sauce
4. Add fresh mozzarella
5. Bake for 12-15 minutes
6. Add fresh basil and olive oil

## Notes
- Best served immediately
- Use high-quality ingredients for authentic taste
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class: card:class:Tag
title: DietaryType
properties:
- label: restrictions
type: TypeString
- label: allergens
type: TypeString
Loading
Loading