wokwi-features icon indicating copy to clipboard operation
wokwi-features copied to clipboard

Add mechanism for remix/breadcrumb/fork/parent/child tracking

Open drf5n opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe. I'm frustrated when I can't find the project from which I copied/derived my project. I'm also frustrated when I cant find the family of derivative project without scrolling through my long list of projects.

Describe the solution you'd like

An excellent solution would provide the functionality of the Github Insights/Netwoth fork tree, (e.g. https://github.com/grbl/grbl/network) or the Thingiverse remix scheme with child links, e.g, https://www.thingiverse.com/thing:16813/remixes and parent links, e.g. https://www.thingiverse.com/thing:1285698 Some sort of tool that one could use to explore projects related to the project.

A minimal solution could be to add the url of the parent project to a comment in the copy's .ino file during the copy operation.

For instance, you opened the Hello World example sketch on: https://docs.wokwi.com/parts/wokwi-lcd1602#simulator-examples which points to https://wokwi.com/projects/294342288335700490 and then "Save A Copy" it might add a comment line to the code like this to the new project:

// Copied from https://wokwi.com/projects/294342288335700490
// LCD1602 to Arduino Uno connection example

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 10, 9, 8, 7);

void setup() {
  lcd.begin(16, 2);
  // you can now interact with the LCD, e.g.:
  lcd.print("Hello World!");
}

void loop() {
  // ...
}

or in the diagram.json:

{
  "version": 1,
  "author": "Uri Shaked",
  "editor": "wokwi",
  "parents":["https://wokwi.com/projects/294342288335700490", "https://wokwi.com/projects/294342288335700490..."],
  "parts": [
    { "id": "uno", "type": "wokwi-arduino-uno", "top": 200, "left": 20 },
    { "id": "lcd", "type": "wokwi-lcd1602", "top": 8, "left": 20 },
    {
      "id": "r1",
      "type": "wokwi-resistor",
      "top": 140,
      "left": 220,
      "attrs": { "value": "220" }
    }
  ],
  "connections": [
    ["uno:GND.1", "lcd:VSS", "black", ["v-51", "*", "h0", "v18"]],
    ["uno:GND.1", "lcd:K", "black", ["v-51", "*", "h0", "v18"]],
    ["uno:GND.1", "lcd:RW", "black", ["v-51", "*", "h0", "v18"]],
    ["uno:5V", "lcd:VDD", "red", ["v16", "h-16"]],
    ["uno:5V", "r1:2", "red", ["v16", "h-118", "v-244", "h50"]],
    ["r1:1", "lcd:A", "pink", []],
    ["uno:12", "lcd:RS", "blue", ["v-16", "*", "h0", "v20"]],
    ["uno:11", "lcd:E", "purple", ["v-20", "*", "h0", "v20"]],
    ["uno:10", "lcd:D4", "green", ["v-24", "*", "h0", "v20"]],
    ["uno:9", "lcd:D5", "brown", ["v-28", "*", "h0", "v20"]],
    ["uno:8", "lcd:D6", "gold", ["v-32", "*", "h0", "v20"]],
    ["uno:7", "lcd:D7", "gray", ["v-36", "*", "h0", "v20"]]
  ]
}

Metadata like this also might enable searches for remixes, such as something like "SELECT * from sketches where sketches.parents contains "https://wokwi.com/projects/294342288335700490"; in the backend to find remixes.

If you can capture/use the ancestry/forking history, it could make it easier to find sets of related models. Or to or chase down errors in upstream sketches. Automating the citing of sources would make it easier to build community around families of sketches. As would the search box in https://github.com/wokwi/wokwi-features/issues/92

drf5n avatar Jan 16 '24 20:01 drf5n