graphviz-conventions.dot 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. digraph STYLE_GUIDE {
  2. // The style guide for our process DSL, written in the DSL itself
  3. // Node type examples with their shapes
  4. subgraph cluster_node_types {
  5. label="NODE TYPES AND SHAPES";
  6. // Questions are diamonds
  7. "Is this a question?" [shape=diamond];
  8. // Actions are boxes (default)
  9. "Take an action" [shape=box];
  10. // Commands are plaintext
  11. "git commit -m 'msg'" [shape=plaintext];
  12. // States are ellipses
  13. "Current state" [shape=ellipse];
  14. // Warnings are octagons
  15. "STOP: Critical warning" [shape=octagon, style=filled, fillcolor=red, fontcolor=white];
  16. // Entry/exit are double circles
  17. "Process starts" [shape=doublecircle];
  18. "Process complete" [shape=doublecircle];
  19. // Examples of each
  20. "Is test passing?" [shape=diamond];
  21. "Write test first" [shape=box];
  22. "npm test" [shape=plaintext];
  23. "I am stuck" [shape=ellipse];
  24. "NEVER use git add -A" [shape=octagon, style=filled, fillcolor=red, fontcolor=white];
  25. }
  26. // Edge naming conventions
  27. subgraph cluster_edge_types {
  28. label="EDGE LABELS";
  29. "Binary decision?" [shape=diamond];
  30. "Yes path" [shape=box];
  31. "No path" [shape=box];
  32. "Binary decision?" -> "Yes path" [label="yes"];
  33. "Binary decision?" -> "No path" [label="no"];
  34. "Multiple choice?" [shape=diamond];
  35. "Option A" [shape=box];
  36. "Option B" [shape=box];
  37. "Option C" [shape=box];
  38. "Multiple choice?" -> "Option A" [label="condition A"];
  39. "Multiple choice?" -> "Option B" [label="condition B"];
  40. "Multiple choice?" -> "Option C" [label="otherwise"];
  41. "Process A done" [shape=doublecircle];
  42. "Process B starts" [shape=doublecircle];
  43. "Process A done" -> "Process B starts" [label="triggers", style=dotted];
  44. }
  45. // Naming patterns
  46. subgraph cluster_naming_patterns {
  47. label="NAMING PATTERNS";
  48. // Questions end with ?
  49. "Should I do X?";
  50. "Can this be Y?";
  51. "Is Z true?";
  52. "Have I done W?";
  53. // Actions start with verb
  54. "Write the test";
  55. "Search for patterns";
  56. "Commit changes";
  57. "Ask for help";
  58. // Commands are literal
  59. "grep -r 'pattern' .";
  60. "git status";
  61. "npm run build";
  62. // States describe situation
  63. "Test is failing";
  64. "Build complete";
  65. "Stuck on error";
  66. }
  67. // Process structure template
  68. subgraph cluster_structure {
  69. label="PROCESS STRUCTURE TEMPLATE";
  70. "Trigger: Something happens" [shape=ellipse];
  71. "Initial check?" [shape=diamond];
  72. "Main action" [shape=box];
  73. "git status" [shape=plaintext];
  74. "Another check?" [shape=diamond];
  75. "Alternative action" [shape=box];
  76. "STOP: Don't do this" [shape=octagon, style=filled, fillcolor=red, fontcolor=white];
  77. "Process complete" [shape=doublecircle];
  78. "Trigger: Something happens" -> "Initial check?";
  79. "Initial check?" -> "Main action" [label="yes"];
  80. "Initial check?" -> "Alternative action" [label="no"];
  81. "Main action" -> "git status";
  82. "git status" -> "Another check?";
  83. "Another check?" -> "Process complete" [label="ok"];
  84. "Another check?" -> "STOP: Don't do this" [label="problem"];
  85. "Alternative action" -> "Process complete";
  86. }
  87. // When to use which shape
  88. subgraph cluster_shape_rules {
  89. label="WHEN TO USE EACH SHAPE";
  90. "Choosing a shape" [shape=ellipse];
  91. "Is it a decision?" [shape=diamond];
  92. "Use diamond" [shape=diamond, style=filled, fillcolor=lightblue];
  93. "Is it a command?" [shape=diamond];
  94. "Use plaintext" [shape=plaintext, style=filled, fillcolor=lightgray];
  95. "Is it a warning?" [shape=diamond];
  96. "Use octagon" [shape=octagon, style=filled, fillcolor=pink];
  97. "Is it entry/exit?" [shape=diamond];
  98. "Use doublecircle" [shape=doublecircle, style=filled, fillcolor=lightgreen];
  99. "Is it a state?" [shape=diamond];
  100. "Use ellipse" [shape=ellipse, style=filled, fillcolor=lightyellow];
  101. "Default: use box" [shape=box, style=filled, fillcolor=lightcyan];
  102. "Choosing a shape" -> "Is it a decision?";
  103. "Is it a decision?" -> "Use diamond" [label="yes"];
  104. "Is it a decision?" -> "Is it a command?" [label="no"];
  105. "Is it a command?" -> "Use plaintext" [label="yes"];
  106. "Is it a command?" -> "Is it a warning?" [label="no"];
  107. "Is it a warning?" -> "Use octagon" [label="yes"];
  108. "Is it a warning?" -> "Is it entry/exit?" [label="no"];
  109. "Is it entry/exit?" -> "Use doublecircle" [label="yes"];
  110. "Is it entry/exit?" -> "Is it a state?" [label="no"];
  111. "Is it a state?" -> "Use ellipse" [label="yes"];
  112. "Is it a state?" -> "Default: use box" [label="no"];
  113. }
  114. // Good vs bad examples
  115. subgraph cluster_examples {
  116. label="GOOD VS BAD EXAMPLES";
  117. // Good: specific and shaped correctly
  118. "Test failed" [shape=ellipse];
  119. "Read error message" [shape=box];
  120. "Can reproduce?" [shape=diamond];
  121. "git diff HEAD~1" [shape=plaintext];
  122. "NEVER ignore errors" [shape=octagon, style=filled, fillcolor=red, fontcolor=white];
  123. "Test failed" -> "Read error message";
  124. "Read error message" -> "Can reproduce?";
  125. "Can reproduce?" -> "git diff HEAD~1" [label="yes"];
  126. // Bad: vague and wrong shapes
  127. bad_1 [label="Something wrong", shape=box]; // Should be ellipse (state)
  128. bad_2 [label="Fix it", shape=box]; // Too vague
  129. bad_3 [label="Check", shape=box]; // Should be diamond
  130. bad_4 [label="Run command", shape=box]; // Should be plaintext with actual command
  131. bad_1 -> bad_2;
  132. bad_2 -> bad_3;
  133. bad_3 -> bad_4;
  134. }
  135. }